Skip to main content

Get a server access token

To use Shakr API, you need to retrieve an access token using OAuth 2.0. Getting the token is simple with the Client ID and the Client Secret, which were issued to you upon joining Shakr.

An access token is comprised of a server access token and a scoped access token. When you call the API on your server application, a server access token, which has all the privileges, is used. You have to be careful not to expose server access token to the client (such as user's browser) because it has privileges on all the resources made through the API.

To learn more about access tokens, please refer to Authentication and Access Token.


Get server access token

You can issue a server access token using the sample code below. Choose a language of your choice, then fill in your Client ID and Client Secret to request a token.

curl 'https://api.shakr.com/oauth/token' \
-X POST \
--header 'Content-Type: application/json' \
--data-raw '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}'
{
"access_token": "eyJ0eXA...K-tsNKOcw", // server access token
"created_at": 1611559222,
"token_type": "bearer"
}

access_token inside the JSON object refers to the server access token. You can save this and use it to make an API call.

After you acquire the server access token, now it's time to choose a template! Let's move on to Choose a creative template.