Unknow Credentials When Try To Refresh Token
Hi Chris,
when i try to using "authorization/token", grant_type=client_credentials :
Authorization: Basic bG9jYWxfdGVzdGVyOmVoU2FsYWgx
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
i got a response, access-token, refresh_token, scope (success), but when i want to use refresh token, i get message like this :
{
"error": "server_error",
"error_description": "Unknown credentials"
}
i already use same basic authorization, as above when i want request new token :
Authorization: Basic bG9jYWxfdGVzdGVyOmVoU2FsYWgx
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=[refresh_token]
did i miss some configuration on scope or header or somethings ?
Hi, so if you want to use the refresh_token grant type you need to provide as Authorization header the Bearer token which you have obtained previously, this means also that you must make the request before your token is actually expired.
ok, i already tried but the result :
{
"error": "invalid_request",
"error_description": "Credentials not available"
}
and this is my header :
Authorization: Bearer [token_from_previous_request]
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=[refresh_token]
Ok, could you try to use at the Authorization header your client id/secret credentials which you also use to obtain the token in the first place, then it should work, please also take a look at the OAuth2 spec s. https://datatracker.ietf.org/doc/html/rfc6749#section-6
You can also consume the consumer/login API
### Consumer Login
POST /consumer/login
Host: localhost
Content-Type: application/json
{
"username": "my_username",
"password": "my_password"
}
### Refresh consumer token
PUT /consumer/login
Host: localhost
Content-Type: application/json
{
"refresh_token": "my_valid_refresh_token"
}