Get Auth Token
Introduction
This API returns a JWT Auth token when provided a valid client id and client secret.
Method | Service | API Name | API Type |
---|---|---|---|
POST | api | auth | Synchronous |
URI: {baseUrl}/api/auth
Header Elements
The following parameters must be sent in the header with every request.
Parameter | Description | Type | Required |
---|---|---|---|
accept | The content type to accept. This must always be the string accept: application/json | String (static) | Yes |
authorization | Authorization method to be used. The authorization parameter consists of the authorization type and the base64 encoded string of the form {clientId}:{clientSecret} The authorization type must always be the string Basic .Example: Authorization: Basic LP0cdWQxxW1zZUlXe4POLTMrwVd7FDLaopD4aI4qaZ0YHNNsBVCUJCL8YPJ9qQ1VcuYHN3a2M6jjyJNMsA== | String | Yes |
content-type | This must always be content-type: application/x-www-form-urlencoded | String (static) | Yes |
response_type | This must always be response_type: token id_token | String (static) | Yes |
accept: application/json
authorization: Basic LP0cdWQxxW1zZUlXe4POLTMrwVd7FDLaopD4aI4qaZ0YHNNsBVCUJCL8YPJ9qQ1VcuYHN3a2M6jjyJNMsA
content-type: application/x-www-form-urlencoded
response_type: token id_token
content-length: 29
host: certification.promob2b.bhnapi.com
cache-control: no-cache
Body Elements
The following parameters must be sent in the body of the request.
Parameter | Description | Type | Required |
---|---|---|---|
grant_type | This must always contain the value client_credentials | String (static) | Yes |
scope | This optional parameter allows the token scope to be specified. If provided this must be one of the scope values Blackhawk Network has configured for your integration. If the scope is not provided the default scope will be used which allows the token to be used for any APIs for which access has been configured. | String | No |
Sample Request
POST https://certification.promob2b.bhnapi.com/api/auth HTTP/1.1
accept: application/json
authorization: Basic LP0cdWQxxW1zZUlXe4POLTMrwVd7FDLaopD4aI4qaZ0YHNNsBVCUJCL8YPJ9qQ1VcuYHN3a2M6jjyJNMsA
content-type: application/x-www-form-urlencoded
response_type: token id_token
content-length: 29
host: certification.promob2b.bhnapi.com
cache-control: no-cache
grant_type=client_credentials
curl --request POST \
--url https://{baseUrl}/authentication/auth \
--header 'accept: application/json' \
--header 'Authorization: Basic MG9hcWVnaW8xMXlXd2FVMTMwaDc6REJkbmE2dW5ndW1CYWNnRFJUOGJ2UWE1eE1ScUVNU2w1T3llbXNVdA==' \
--header 'content-type: application/x-www-form-urlencoded' \
--header 'response_type: token id_token' \
--data 'grant_type=client_credentials'
Sample Responses
Upon success a base64 encoded JWT auth token will be returned. This auth token must be used with every API request.
The issued auth token is valid for 600 seconds (10 minutes). After that time you will need to obtain a new auth token by calling this service again.
{
"token_type": "Bearer",
"expires_in": 600,
"access_token": "eyJraWQiOiJOZm9uOFI3T0xkTmNPUlNSUVhzdW13WXlOZzRtblB1LTA3ZzhKTEw2NGZvIiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULnQ4NnVfaTJHeG01T1p0TmlOSHNjTnJDaGZTNUgtcVhLelJYZTBoMkMtYjQiLCJpc3MiOiJodHRwczovL2Rldi05OTMxMDcub2t0YXByZXZpZXcuY29tL29hdXRoMi9hdXNqanZwZzNhYTl5c05XeTBoNyIsImF1ZCI6Imh0dHBzOi8vd3d3LmJobmV0d29yay5jb20vYXBpIiwiaWF0IjoxNTg0NTYyMjM5LCJleHAiOjE1ODQ1NjU4MzksImNpZCI6IjBvYWprcXdoNnRTR1JXVWN3MGg3Iiwic2NwIjpbIiovKiJdLCJzdWIiOiIwb2Fqa3F3aDZ0U0dSV1VjdzBoNyJ9.PfT7O9Kae-8UEIqjZI5CDV4DdiP2z60I_LTYHIcYMLGYMW6jzvaZLQL9LJvhXpi9uzY5cFhAROOJGK7Uwf616DzTRKJ1_SmcNbxCxuzOknR0tvh6aeLepeVhDW6gdJGic9dW3YYWX2fUdyACCZjjQ3ME_26Oy3qaJj5j89jlJgxTE-QZHDUeCnE5oxRzQQaEF6bXXZ_X_yWEM4bS4PJcp99ysmJO838U0afC9pczatx_LEy2PnET2pP6RNLYx-oq0_LgrdjlV-7C92LQylqzxas-yZbtN7jHD4JvUt6TJchOnce2wQKoId4-rF_Z8NdTzMYfqcgg_L_v2ZbT8xzMRA",
"scope": "*/default/*"
}
{
"error": "invalid_scope",
"error_description": "One or more scopes are not configured for the authorization server resource."
}
{
"errorCode": "E0000021",
"errorSummary": "Bad request. Accept and/or Content-Type headers likely do not match supported values.",
"errorLink": "E0000021",
"errorId": "oaeJCQnzjWAQ4-f45F5RNGskA",
"errorCauses": []
}
Updated over 4 years ago