1. Home
  2. Docs
  3. Getting started
  4. Receive a valid Access_Token

Receive a valid Access_Token

At your subscription, Bizao will provide you:

  • a CLIENT_ID :
    • Sample:
      zrYcdShzZgVRszIchOaEcU904sa
  • a CLIENT_SECRET :
    • Sample:
      zqxYcdrtzZgVRipzIc2sEcgHpmdA

Step 01 – Generate basic token

Generate a basic token based on your CLIENT_ID and your CLIENT_SECRET encoded in base64. See the sample below:

CLIENT_ID = “N2xe7xzk25FZEnS0YgmlD10a”
CLIENT_SECRET = “xpPDskBI9GKpbPjkHJrAN6Qa”
YOUR_BASIC_AUTHORIZATION  base64(CLIENT_ID:CLIENT_SECRET) = 
  “TjJ4ZTd4emsyNUZaRW5TMFlnbWxEMTBhOnhwUERza0JJOUdLcGJQamtISnJBTjZRYQ==” 


Below a screenshot of how to encode a string in base64 format on https://www.base64encode.org/


Below a sample of how to generate YOUR_BASIC_AUTHORIZATION using PHP:

$id = "N2xe7xzk25FZEnS0YgmlD10a";
$secret = "xpPDskBI9GKpbPjkHJrAN6Qa";
$yourBasicAuthorization = base64_encode("$id:$secret");

Step 02 –  Get your ACCESS_TOKEN

  • Bizao-URI: /token
  • Bizao-Host: api.bizao.com

Sample request :

Curl -X POST \
https://api.bizao.com/token \
-H 'authorization: Basic TjJ4ZTd4emsyNUZaRW5TMFlnbWxEMTBhOnhwUERza0JJOUdLcGJQamtISnJBTjZRYQ==' \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded'
-d "grant_type=client_credentials" \

Success query response

{
"access_token": "YOUR_ACCESS_TOKEN",
"scope": "am_application_scope default",
"token_type": "Bearer",
"expires_in": 31536000
}

Note:

As long as your ACCESS_TOKEN is valid, this request will give you the same token with the remaining time before expiration in seconds (see expires_in parameter)

After the expiration date, this request will regenerate a new ACCESS_TOKEN

Was this article helpful to you? Yes 3 No 2

How can we help?