Issuing access tokens
This section describes the procedure for issuing access tokens.
Prerequisites
You must have a basic authorization header that was issued as a result of the credential creation.
Access Token Issuance Procedure
Run the terminal.
Use the basic authorization header to request the ChainZ API authorization server to issue an access token.
curl 'https://iam.chainz.biz/auth/realms/chainz/protocol/openid-connect/token' \
-H 'Authorization: {Basic_Authorization_Header}' \
--data-raw 'grant_type=client_credentials'
{
"access_token": "{access token}",
"expires_in": 300,
"refresh_expires_in": 0,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": "opera-scope profile email"
}
The default validity period for an issued access token is 600 seconds. Therefore, the application implementation server requires additional work to be able to update within 600 seconds.
Troubleshooting
1. unauthorized_client
If you enter an invalid basic authorization header, you will see the result of an 'unauthorized_client' error as follows:
curl 'https://{ChainZ API authorization server URL} /auth/realms/chainz/protocol/openid-connect/token' \
-H 'Authorization: {Invalid Basic Authorization Header} ' \
--data-raw 'grant_type=client_credentials'
{"error":"unauthorized_client","error_description":"Invalid client secret"}
{
"error": "unauthorized_client",
"error_description": "Invalid client secret"
}
2. URL using bad/illegal format or missing URL
When entering curl in the terminal, if there is a space after a backslash (), you will receive a message in Response stating that the URL is bad or missing (URL using bad/invalid format or missing URL).
$ curl 'https://iam.chainz.biz/auth/realms/chainz/protocol/openid-connect/token' \
{"error":"RESTEASY003650: No resource method found for GET, return 405 with Allow header"}
curl: (3) URL using bad/illegal format or missing URL
Last updated