Generate Access Token

After subscription, the Bizao Team will give you an ACCESS_TOKEN to use as Header in all calls you will make to our APIs:
Sample of an BASIC_TOKEN

1. Main credentials

At subscription the Bizao team will provide you with :

a CLIENT_ID : Sample “N2xe7xzk25FZEnS0YgmlD10a”

a CLIENT_SECRET : Sample “N2xe7xzk25FZEnS0YgmlD10a”

2. Generate your ACCESS_TOKEN

Here are the steps to generate your ACCESS_TOKEN :

• Step 1 : Generate YOUR BASIC_TOKEN

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

CLIENT_ID : “N2xe7xzk25FZEnS0YgmlD10a”

CLIENT_SECRET : “xpPDskBI9GKpbPjkHJrAN6Qa”

YOUR BASIC TOKEN : ”TjJ4ZTd4emsyNUZaRW5TMFlnbWxEMTBhOnhwUERza0JJOUdLcGJQamtISnJBTjZRY Q==“

You can visit this website to generate your BASIC_TOKEN by encoding your CLIENT_ID and CLIENT_SECRET under the following format : CLIENT_ID:CLIENT_SECRET

Encode to Base64 format

Below a code sample on how to generate your ACCESS_TOKEN using PHP :

PHP

1 ‹?php
2 $id = “N2xe7xzk25FZEnS0YgmlD10a”;
3 $secret = “xpPDskBI9GKpbPjkHJrAN6Qa”;
4 $yourBasicAuthorization = base64_encode(“$id:$secret”);
5 echo $yourBasicAuthorization;
6 ?›

• Step 2 :

Make a request to the endpoint https://api.www.bizao.com/token by providing your generated BASIC_TOKEN ( here TjJ4ZTd4emsyNUZaRW5TMFlnbWxEMTBhOnhwUERza0JJOUdLcGJQamtISnJBTjZRYQ== ).

cURL

1 curl —location —request POST ‘https://api.www.bizao.com/token’ \
2 -H ‘authorization : Basic TjJ4ZTd4emsyNUZaRW5TMFlnbWxEMTBhOnhwUERza0JJOUdLcGJQamtISnJBTjZRYQ==‘ \
3 -H ‘content-type : application/x-www-form-urlencoded’ \
4 -d ‘grant_type=client_credentials’ \

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

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

Retour en haut