Access Token Generation
This section of the documentation explains how to generate the access token needed to authenticate with the Blerify API.
Last updated
This section of the documentation explains how to generate the access token needed to authenticate with the Blerify API.
Last updated
Before using the Blerify API endpoints, you need to authenticate using an access token. This token is obtained from a Service Account previously created in the Blerify portal.
To access the Blerify API, you need to create a Service Account. Follow these steps:
Access the Blerify portal: Log in to the Blerify portal using your credentials.
Navigate to the "Service Accounts" section: Locate and select the "Service Accounts" section in the portal menu.
Create a new Service Account: Click the "Create Service Account" button.
Complete the Service Account information:
Enter a descriptive name to identify the account (e.g., "Payments Application", "CRM Integration").
You can add a description to detail the use of this account.
Select the type of encryption algorithm.
Select one or more roles that will grant permissions to the Access Token that will be generated.
Finish and Download the JSON file: Blerify will generate a JSON file containing the information needed to generate the access token. Store this file in a secure location and do not share it with anyone.
File format: JSON
Once you have created the Service Account and downloaded the JSON file, you can generate the access token using your preferred programming language. Here is an example with a Blerify client library developed in PHP.
Example code (PHP):
Response (Example of Generated Access Token):
access_token: The generated access token.
expires_in: Lifetime in seconds of the access token. In this example, 3600 seconds (1 hour).
refresh_token: A token that can be used to obtain a new access token without re-authenticating the user.
Important: The access token has a limited lifetime, specified in the expires_in
parameter.
Check expiration: Before using the access token, the developer should check if it has expired. To do this, they can compare the current timestamp with the sum of the token generation timestamp and the expires_in
value.
Generate a new token: If the access token has expired, the developer must generate a new one using the Blerify client library.
Store the token securely: The access token should be stored securely to prevent unauthorized use.
Once you have obtained the access token, you can use it to access the Blerify API endpoints. To do this, you must include the access token in the Authorization
header of the HTTP request, using the Bearer
scheme.