Google oAuth2 redirect_uri_mismatch in token access

独自空忆成欢 提交于 2019-12-11 10:36:25

问题


I am trying to access token from one-time code using Google oAuth2. But I am getting an error message redirect_uri_mismatch in the response. However i've already added the redirect_uri in console.

I have my Authorized redirect uri as:

http://localhost:3020/api/users/google_oauth_store_token

My request:

Request URL = https://www.googleapis.com/oauth2/v3/token?code=xXXXxx&client_id=xxxxxx&client_secret=xxx&redirect_uri=http://localhost:3020/api/users/google_oauth_store_token&grant_type=authorization_code

My response:

  response = {
    "error": "redirect_uri_mismatch",
    "error_description": "Bad Request"
  }

回答1:


That was my mistake. I had to use the redirect_uri that i had used in one-time redirect uri. Google uses one of the redirect_uri to rest the client origin.



来源:https://stackoverflow.com/questions/31567419/google-oauth2-redirect-uri-mismatch-in-token-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!