Authentication
Browser Session
Generates an access token for Cart API authentication
POST
Browser Session
Overview
Browser Session is the authentication endpoint that serves as the starting point for all Cart API integrations. It exchanges your Application ID for an access token that authenticates subsequent API calls.Authentication
Your Application ID provided by Firmly
Request Body (Optional)
An expired access token (valid up to 1 week after expiration) to renew
Response
Indicates whether or not a new device was created for this session
The JWT access token to use in x-firmly-authorization header for all API calls
Number of seconds until the token expires (typically 3600)
Unix timestamp when the token expires
Unique identifier for this device session
Code Examples
Token Renewal
You can renew an expired token up to 1 week after expiration:Using the Access Token
After obtaining the access token, include it in all API requests:Error Responses
400 Bad Request
400 Bad Request
Invalid or missing Application ID
401 Unauthorized
401 Unauthorized
Best Practices
- Token Refresh: Implement automatic token refresh before expiration. The authorization token represents the user’s device. It should be stored with the user; not with the backend
- Error Handling: Handle token expiration gracefully with retry logic
Implementation Example
Next Steps
After authentication, you can:- Get Cart - Retrieve the current cart
- Browse Products - View available products
- Add to Cart - Add items to cart
Browser Session