Skip to main content

Access Token

Access token is necessary to access any API described in this guide. You can get the access token using OAuth2.0 client credentials flow.

Call for Token

To get the access token, you need to send a POST request to the following endpoint:

Demo Token Curl

curl --location 'https://demo.hng.one/oauth/oauth/token' \
--header 'Content-Type: application/json' \
--data '{
"grant_type": "client_credentials",
"client_id": "<<YOUR_CLIENT_ID>>",
"client_secret": "<<YOUR_CLIENT_SECRET>>",
"audience": "https://play.medeintegra.dev"
}'

Prod Token Curl

curl --location 'https://aths.hng.one/oauth/oauth/token' \
--header 'Content-Type: application/json' \
--data '{
"grant_type": "client_credentials",
"client_id": "<<YOUR_CLIENT_ID>>",
"client_secret": "<<YOUR_CLIENT_SECRET>>",
"audience": "https://medeintegra.dev"
}'

Sample Response

You will receive a response similar to below

{
"code": "Ok",
"message": "Token Obtained Successfully",
"token_type": "Bearer",
"access_token": "<<JWT_TOKEN>>",
"expires_in": 3600
}

The access_token in the response can be used to access the APIs.