Authentication
Every API in this portal is reached through the platform’s central API gateway, and every request to the gateway needs an access token issued by Auth0. This page explains how to get a token and how to use it.
How it works
- You have a client ID, a client secret, and an organization ID that were set up for you by 360insights in Auth0.
- Your server exchanges them with Auth0 for an access token (a JWT) using the OAuth 2.0 client credentials grant.
- You send the token to the gateway on every API request, as
Authorization: Bearer <token>.
A token is valid for 24 hours (the expires_in field of the response gives the lifetime in seconds). Request one and reuse it
until shortly before it expires. Don’t request a new token for every API call: Auth0 rate-limits its token-granting endpoint.
Getting a token
Use the form below or send a POST request with a JSON body to this environment’s Auth0 token endpoint:
https://360insights-org-qa.us.auth0.com/oauth/token
| Field | Required | Value |
|---|---|---|
grant_type |
yes | client_credentials |
client_id |
yes | Your 360insights-issued client ID |
client_secret |
yes | Your 360insights-issued client secret |
organization |
yes | Your 360insights-issued organization ID |
audience |
yes | https://api.test.360insights.io: always, see below |
scope |
no | Space-separated scopes to request: see Scopes |
For example:
curl -s -X POST https://360insights-org-qa.us.auth0.com/oauth/token \
-H 'content-type: application/json' \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"organization": "YOUR_ORGANIZATION_ID",
"audience": "https://api.test.360insights.io"
}'
The response contains the token and what it allows:
{
"access_token": "eyJ...",
"scope": "access:myrewards:gps access:myrewards:my-rewards ...",
"expires_in": 86400,
"token_type": "Bearer"
}
Your token (JWT) is the access_token value. scope lists the scopes the token carries.
Keep the client secret secret
Treat the client secret like a password: keep it in your server-side vault or secrets manager, and never commit it or put it in code that runs in a browser or mobile app where it could be exfiltrated by a malicious actor. Notify 360insights if you suspect that your client secret has been compromised and is no longer secret. (The form below is different: it sends the value straight from your browser to Auth0 without storing it.)
Always request the gateway’s audience
Auth0 issues each token for one API, named by the audience field. Every API in this portal
is reached through the gateway, so always set audience to https://api.test.360insights.io, which identifies the gateway.
A token requested for any other audience, or without one, is not a token for the gateway and will be rejected.
Get a token here
Enter your client credentials to request a token for this environment. Your browser sends them straight to Auth0 (360insights-org-qa.us.auth0.com); this site doesn't keep or log them, and clears the secret as soon as the token arrives. The same request is shown as a curl command below, which you can use instead.
The same request with curl
Using the token
Send the token in the Authorization header of every request to the gateway:
curl https://api.test.360insights.io/<domain>/<apiName>/<route> \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Each API’s page shows its exact base URL, and the API catalogue lists them all. A request without a valid
token is rejected with 401 Unauthorized; if your token has expired, request a new one from Auth0.
To use an API’s Try it, open its Authentication section, choose Bearer and paste in the token (just the token,
without the word Bearer).
Scopes
A scope is a permission carried by a token, and each API has one (the form above lists them). Asking for scopes is optional:
- Omit
scopeentirely (default) and Auth0 issues a token carrying every scope granted to you. This is what most callers want. - Request specific scopes (space-separated, for example
"scope": "access:myrewards:gps") only if you want a token that is more restricted than the permissions that 360insights has allowed you. Requesting scopes that 360insights has not granted will result in a token restricted to only the scopes that have been granted.
A token can only be used with an API if it carries that API’s scope. You never need to ask for the scopes of the services behind the gateway: the gateway takes care of that itself.
