[Platform] How to get OAuth access token with Postman
Question
How to get access token from OAuth credentials of access key ID and access key secret?
Answer
For testing purposes, you can use the OLP CLI tool to get the token easily by following the guide below:
https://www.here.com/docs/bundle/identity-and-access-management-developer-guide/page/topics/plat-token.html#step-3-get-a-token
In production, you can use the lib from 3rd party to generate the token by referring the following guide for Python:
https://www.here.com/docs/bundle/identity-and-access-management-developer-guide/page/topics/python-oauth-token.html
Postman
This guide is for you if you may also want to get the access token from an API dubugging or testing tools such as Postman.
1. Use POST action upon the URL https://account.api.here.com/oauth2/token
2. Under Authorization tab, configure following settings:
Auth Type: OAuth 1.0
Add authorization data to: Request Headers
Signature Method: HMAC-SHA256
Consumer Key: {{your access key ID}}
Consumer Secret: {{your access key secret}}
Timestamp: {{your current timestamp}}
Version: 1.0
Encode the parameters in the Authorization header: checked
You can get your current timestamp from online tools such as https://tool.lu/timestamp

3. Under Body tab, configure the payload as follows:
grantType: client_credentials
expiresIn: 86400
You can set the expiresIn value to 3600 for one hour or 86400 for 24 hours or any other values in between.
It is not recommended to set expiresIn value to be less than 3600 (one hour) and the max value of it is 86400 (24 hours).
If you do not provide expiresIn value, it defaults to 86400 (24 hours) and any value above it will fall back to 86400 (24 hours) implicitly.
4. Send the request and you can get the token under the accessToken value in response with 200 OK status:
Note, if your used credentials are from an app linked with a project, then there is a scope value in reponse that may limit your accessibility to HERE services.
For more details about the scope, check the linked project of your app or just remove the link to free your app from the limit by the project.
Errors
There could be various kinds of errors if the configuration is not correct, we cannot enumerate all but there are some examples:
Your timestamp is not current or has an offset over 120 seconds > Check your timestamp and try getting it correctly again:
Make sure the checkbox "Encode the parameters in the Authorization header" is checked on the Authorization tab:
Review all settings from the beginnig of this KB article or create support ticket from your support portal if you need further support.