How do I generate the token for authentication?
To use Maplink’s APIs, you need to generate a bearer tokenfrom your unique credentials.
Each bearer token lasts 60 minutes and can be used by any API. After this interval you will need to generate a new token.
Below is an example of the unique credentials that must be used in a body when generating the bearer token:
client_id: 0wf*************************eqFG client_secret: 1b***********owE
With the client_id and client_secret, use the following endpoint with the POST method to obtain the bearer token:
https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials
Request example
curl -X POST "https://api.maplink.global/oauth/client_credential/accesstoken?grant_type=client_credentials" -H "Content-Type: application/x-www-form-urlencoded" --data-urlencode "client_id=0wf*************************eqFG" --data-urlencode "client_secret=1b***********owE"
Response example
The “access_token” : “XBlgpdua80eonaU7FmRjhRsjMe3c” is the one that should be used to authenticate requests from the other APIs for 60 minutes.
{ "refresh_token_expires_in": "0", "api_product_list": "[Matrix, Restriction Zone, Trip, Planning, Toll, Place, Geocode, Toll Search]", "api_product_list_json": [ "Matrix", "Trip", "Planning", "Toll", "Geocode" ], "organization_name": "lbslocal", "developer.email": "[email protected]", "token_type": "BearerToken", "issued_at": "1620249207151", "client_id": "0wf*************************eqFG", "access_token": "XBlgpdua80eonaU7FmRjhRsjMe3c", "application_name": "49136471-81b0-4f23-bfff-980f0337f01e", "scope": "", "expires_in": "3599", "refresh_count": "0", "status": "approved" }