Authentication
Neuroon exposes two credentials depending on where the request comes from. Pick the one that matches the call origin; they are not interchangeable.
Which one do I use?
Comparison
| Mechanism | Header | Format | TTL | Origin | Endpoints |
|---|---|---|---|---|---|
| Widget Token | X-Widget-Token | Opaque string | 24 h | Browser | /api/widget/* |
| Shop API Key | X-Shop-API-Key | sk_<32hex> | Permanent (until rotation) | Your server | /api/plugin/shops/* |
Widget Token flow (frontend)
- Your server signs the Widget Token locally using the
X-Shop-API-Keyas HMAC secret. See Recipe · Server-to-server token for the format and copy-paste code. - Cache the token (~23 h) and inject it as
data-tokenin the<script>your HTML serves. - The widget sends the token on every request as
X-Widget-Token. - After 23 h+ have passed, your server signs again and rotates the token without downtime.
The token is opaque to your frontend; the browser never sees the Shop API Key.
Shop API Key flow (server-to-server)
- Generate a
sk_<32hex>in the Dashboard. - Store it in your secret manager.
- On each request to
/api/plugin/shops/{shopId}/*include:
X-Shop-API-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- If the request carries
Origin(it's a browser), the backend validates it matches your registeredshop.url. If not →403 Forbidden. - If the request has no
Origin/Referer(server-to-server HTTP client:.NET HttpClient,curl,requests,axiosfrom Node), it is allowed.
Common errors
| Symptom | Likely cause |
|---|---|
401 Unauthorized with header present | Token expired, malformed or from a different environment |
401 Unauthorized without header | You forgot the header |
403 Forbidden with Origin mismatch | The browser sent an Origin that does not match shop.url |
403 Forbidden cross-tenant | The sk_* belongs to a different shopId than the URL |
429 Too Many Requests | Rate limit exceeded — see Retry-After |
Per-error detail: Errors.
Further reading
- Widget Token — issuance, rotation, usage.
- Shop API Key — format, Origin validation, rotation.
- Rate Limits — per-endpoint quotas and backoff.
- Errors — codes, structure, field-level errors.