Skip to main content
POST
The Storefront API supports OAuth 2.0 Token Exchange (RFC 8693) for public clients. Your app, web, or kiosk sends the customer’s OIDC ID token and receives a short-lived Fire spark access token in return. No client_id or client_secret is required. Fire spark reads the ID token’s iss and aud claims, finds the merchant’s configured identity provider, validates the token against that provider’s JWKS, and issues an access token bound to the customer identified by the sub claim.

When to use token exchange

Use this endpoint when:
  • Customers sign in with an OIDC-compliant identity provider on the client
  • Your channel needs to call the Storefront API on behalf of that customer
  • You want Fire spark to validate identity and limit API access to a single customer
Send the ID token, not opaque access tokens or API keys. ID tokens are JWTs that identify the authenticated user through standard claims: sub, iss, and aud. Every OIDC-compliant provider exposes them after sign-in.

Prerequisites

  1. Configure your identity provider in the Fire spark dashboard for your merchant.
  2. Authenticate the customer on the client and obtain a fresh OIDC ID token from your provider.

How it works

1

Customer signs in on the client

Your app completes sign-in with your OIDC provider using that provider’s client SDK. Retrieve the ID token the provider issues for the authenticated session.
2

Client sends the ID token

Your client calls POST /oauth/exchange with the ID token as subject_token. No merchant ID or API secret is needed in the request.
3

Fire spark resolves the merchant and validates the token

Fire spark matches the token’s iss and aud to the provider configured for a merchant, verifies the signature and expiration using that provider’s JWKS, and reads sub as the customer’s external identifier.
4

Client uses the Fire spark access token

Fire spark returns an access token for that customer. Use it in the Authorization header for Storefront API requests.

Obtain the ID token

Each provider exposes the ID token through its client SDK. Use the method that returns the JWT ID token for the current session.

Token exchange request

Send a POST request to /oauth/exchange with Content-Type: application/json. The request body is the same regardless of provider.

Request body

How Fire spark identifies the merchant

Fire spark does not require a merchant ID in the request. It inspects the ID token claims: Fire spark matches iss and aud against the provider configuration registered for a merchant, then validates the token signature before issuing an access token.

Supported providers

Any OIDC-compliant provider that issues JWT ID tokens with a discoverable JWKS endpoint is supported. Register the provider in the dashboard before going to production.
The iss and aud values must match exactly what Fire spark has on file for your merchant. Copy them from a decoded ID token when configuring the provider in the dashboard.

Use the exchanged token

Include the Fire spark access token in the Authorization header. The token only grants access to resources for the customer linked to the original sub claim.
Re-exchange when your provider refreshes the ID token. Fire spark access tokens are short-lived and are not a replacement for keeping the IdP session current.

Security properties

  • Public client profile: Designed for mobile and web clients. No confidential credentials are sent or stored in the app.
  • ID token only: Only OIDC JWT ID tokens are accepted as subject_token. Opaque or provider API tokens are rejected.
  • Cryptographic validation: Signature, iss, aud, and exp are verified against the merchant’s registered provider before any customer data is returned.
  • Customer isolation: The issued access token is bound to the sub from the ID token. Requests for other customers are rejected.
  • Short-lived tokens: Exchanged tokens expire after expires_in seconds.
Always call this endpoint over HTTPS. Do not log ID tokens or Fire spark access tokens. Refresh the exchange when your provider rotates the ID token.

Error responses

Errors follow RFC 6749 and RFC 8693. The endpoint returns application/json with an error field.
Error

Body

application/json

Token exchange request.

grant_type
enum<string>
required
Available options:
urn:ietf:params:oauth:grant-type:token-exchange
subject_token
string
required

OIDC ID token from your identity provider.

subject_token_type
enum<string>
required
Available options:
urn:ietf:params:oauth:token-type:id_token

Response

200 - application/json

Ok

data
object