Google oAuth2 redirect_uri_mismatch在令牌访问中 [英] Google oAuth2 redirect_uri_mismatch in token access

查看:149
本文介绍了Google oAuth2 redirect_uri_mismatch在令牌访问中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google oAuth2从一次性代码访问令牌。但是我在响应中收到一条错误消息 redirect_uri_mismatch 。但是我已经在控制台中添加了 redirect_uri

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.

我有我的授权重定向uri 为:

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

我的请求:

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

我的回复:

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


推荐答案

那是我的错误。我必须使用在一次性重定向uri中使用的 redirect_uri 。 Google使用redirect_uri之一来保留客户端的来源。

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.

这篇关于Google oAuth2 redirect_uri_mismatch在令牌访问中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆