Skip to main content

Client Credentials

Before You Begin

Create a new OpenId client integration page in the Integrations page and note your Client id and Secret.

Step 1: Use your Client ID and Secret to obtain an access token

Replace the {CLIENT_ID} and {CLIENT_SECRET} values in the example below with those specific to your OpenId Client.

POST /oauth2/token HTTP/1.1
Host: login.elfsquad.io
Content-Type: application/x-www-form-urlencoded

client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&grant_type=client_credentials&scope=Elfskot.Api

Body (x-www-form-urlencoded):

KEYVALUE
client_id{CLIENT_ID}
client_secret{CLIENT_SECRET}
grant_typeclient_credentials
scopeElfskot.Api

Step 2: Retrieve the access token from the response

A successful response will look like this:

{
"access_token": "{ACCESS_TOKEN}",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "Elfskot.Api"
}

Step 3: Use the access token to access Elfsquad APIs

You can now use the access token to make calls to one of the Elfsquad APIs until the token expires.

GET /data/1/features HTTP/1.1
Host: api.elfsquad.io
Authorization: Bearer {ACCESS_TOKEN}