Authentication

Request an access token

POST
/oauth2/token

Exchanges the Client ID and Client Secret of a REST API integration (created on the InCountry Portal) for an access token. Send the credentials with Basic auth. Tokens are valid for 300 seconds; request a new one when it expires.

Authorization

clientBasicAuth
AuthorizationBasic <token>

Client ID as the username and Client Secret as the password, from your REST API integration on the InCountry Portal.

In: header

Request Body

application/x-www-form-urlencoded

grant_type*"client_credentials"

Always client_credentials.

Value in

  • "client_credentials"
audience*string

Space-separated addresses the token is valid for. Backend requests: the REST API address and the PoP API address of the same country, e.g. https://se-restapi-mt-01.api.incountry.io https://se-mt-01.api.incountry.io. Frontend requests: only the REST API address.

scope*string

Environment ID within the target country. It must match the Client ID and Client Secret.

Response Body

application/json

curl -X POST "https://example.com/oauth2/token" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'grant_type=client_credentials&audience=https%3A%2F%2Fse-restapi-mt-01.api.incountry.io+https%3A%2F%2Fse-mt-01.api.incountry.io&scope=f2e5a966-1564-4c25-a3bf-0ef7a231fb2b'
{  "access_token": "eyJhbGciOiJSUzI1NiIs...",  "expires_in": 300,  "scope": "f2e5a966-1564-4c25-a3bf-0ef7a231fb2b",  "token_type": "bearer"}