Exchange access code
OAuth2
Exchange Code
Exchanges an authorization code for an API key.
GET
Exchange access code
Overview
Exchange an authorization code for a JWT API key. This is the final step in the OAuth2 flow, converting the temporary code into a permanent access token.This endpoint requires the
X-Client-Secret header for authentication instead
of the standard Authorization header.Path Parameters
| Parameter | Type | Description |
|---|---|---|
appId | string | Your application’s Client ID |
code | string | The authorization code received from the callback |
Headers
| Header | Required | Description |
|---|---|---|
X-Client-Secret | Yes | Your application’s 72-character client secret |
User-Agent | Yes | Your application identifier |
Response
data field contains a JWT API key that you can use to make authenticated API requests.
Using the API Key
Include the JWT as a Bearer token in subsequent API requests:Token Properties
The JWT API key:- Grants access only to the stores the user authorized
- Has permissions limited to the scopes you requested and the user approved
- Does not expire until the user revokes authorization
- Is tied to the specific user and application
Error Responses
| Error | Description |
|---|---|
invalid_code | The authorization code is invalid or has already been used |
code_expired | The authorization code has expired (codes are valid for 1 minute) |
invalid_client_secret | The client secret is incorrect |
app_not_found | The application ID is invalid |
Complete Flow Example
Authorizations
Your API key goes here
Path Parameters
The application ID.
The authorization code to exchange.
Response
The object was successfully returned.
Represents a default generic response for API endpoints.
Indicates whether the operation or response was successful.
A descriptive message providing additional context or information about the response.
The error code (if there was an error) to use when referencing the error
Represents the data associated with a response.