oauth2 authentication

5 months ago
Hi,
I want to get access token. For that I first make GET request
http://mystore/oauth/authorize?redirect_uri=http%3A%2F%2Fmystore/oauth-callback&client_id=<myclientid>&response_type=code

Then I get code from response uri and make next POST request
http://mystore/api/token
with headers:
["Content-Type":"application/x-www-form-urlencoded","Accept":"application/json"

and fields:
client_id, client_secret, code, grant_type= authorization_code, redirect_uri.
Finally, i get error response:

{
    "error": "unauthorized_client"
}
and if I repeat same request I will get another error:

{
    "error": "invalid_grant"
}


What is the problem?
5 months ago
oleksandr.lysun wrote:
Hi,
I want to get access token. For that I first make GET request
http://mystore/oauth/authorize?redirect_uri=http%3A%2F%2Fmystore/oauth-callback&client_id=<myclientid>&response_type=code

Then I get code from response uri and make next POST request
http://mystore/api/token
with headers:
["Content-Type":"application/x-www-form-urlencoded","Accept":"application/json"

and fields:
client_id, client_secret, code, grant_type= authorization_code, redirect_uri.
Finally, i get error response:

{
    "error": "unauthorized_client"
}
and if I repeat same request I will get another error:

{
    "error": "invalid_grant"
}


What is the problem?

Hello.
... have a look at this link...
https://developers.google.com/identity/protocols/OpenIDConnect#setredirecturi