Skip to content

Token

POST https://api.xerberusapp.com/token/

Required parameters

grant_type: client_credentials

client_id: CLIENT_ID

client_secret: CLIENT_SECRET

Note

grant_type must always be passed as value "client_credentials"

Description

An endpoint to request an access token using your CLIENT_ID and CLIENT_SECRET passed in the POST parameters. Access tokens allow you access to resources.

Example requests

CURL:

curl -X POST https://api.xerberusapp.com/token -d 'client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials'

PHP:

<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'https://api.xerberusapp.com/token',
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => [
        'client_id' => 'CLIENT_ID',
        'client_secret' => 'CLIENT_SECRET',
        'grant_type' => 'client_credentials'
    ]
]);

# Contains your access token data
$response = json_decode(curl_exec($curl));
curl_close($curl);

Example responses

Success:

{
    "access_token":"2f563a4909b0f2d28de9d454030b0b6f48bf321b",
    "expires_in":3600,
    "token_type":"Bearer",
    "scope":"basic"
}

Invalid credentials:

{
    "error": "invalid_client",
    "error_description":"The client credentials are invalid"
}

Usage

To use your access token to gain access to resources, add it to your Authorization header.

curl -X GET https://api.xerberusapp.com/hello -H 'Authorization: Bearer 2f563a4909b0f2d28de9d454030b0b6f48bf321b'