错误:尝试使用oauth获取access_token时,redirect_uri_mismatch [英] Error: redirect_uri_mismatch while trying to get access_token using oauth

查看:497
本文介绍了错误:尝试使用oauth获取access_token时,redirect_uri_mismatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照developers.google.com/accounts/docs/OAuth2InstalledApp(我已经非常努力地遵循)中的说明获取access_token,但仍然遇到redirect_uri_mismatch错误.我究竟做错了什么?

I am trying to get access_token using the instructions here developers.google.com/accounts/docs/OAuth2InstalledApp (which I have followed very diligently) but keep hitting the redirect_uri_mismatch error. What am I doing wrong?

首先,我使用控制台创建一个已安装的应用程序/其他应用程序(

First I create a installed app/other using the console (

本机应用程序的客户端ID

Client ID for native application

客户端ID ... 客户机密... 重定向URI

Client ID ... Client secret ... Redirect URIs

    urn:ietf:wg:oauth:2.0:oob
    local host url

使用浏览器成功使用授权码

Got the authorization code successfully using the browser using

https:// accounts.google.com/o/oauth2/auth?client_id=818722811109-8ak0a1l3ooqqt3bd97bktr33ghenlptk.apps.googleusercontent.com&redirect_uri=http://:51551/Callback&response_type=code&scope=

https:// accounts.google.com/o/oauth2/auth?client_id=818722811109-8ak0a1l3ooqqt3bd97bktr33ghenlptk.apps.googleusercontent.com&redirect_uri=http://:51551/Callback&response_type=code&scope=https://www.googleapis.com/auth/adexchange.seller.readonly&access_type=offline

curl -d"code = ...& client_id = ...& client_secret = ...& grant_type = authorization_code& redirect_uri = urn:ietf:wg:oauth:2.0:oob" -X POST https :// account.google.com/o/oauth2/token

curl -d "code=...&client_id=...&client_secret=...&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob" -X POST https:// accounts.google.com/o/oauth2/token

给我错误"redirect_uri_mismatch"

gives me error "redirect_uri_mismatch"

我无所适从.我从非域控制台使用控制台中的redirect_uri,但无法克服此错误.

I'm at a loss what I am doing wrong. I use the redirect_uri from the console which is for the non-domain one, but can't get past this error.

任何指针将不胜感激.

Any pointers would be appreciated.

谢谢.

推荐答案

http://:51551/Callback不是有效的redirect_uri,因此您提到的链接无法获得授权代码.因此,我怀疑您是否以这种方式获得授权代码.

http://:51551/Callback is not a valid redirect_uri, so the link you mentioned can not get authorization code. So I doubt that the authorization code you get in this way.

使用这个:

Use this one:
https://accounts.google.com/o/oauth2/auth?client_id=818722811109-8ak0a1l3ooqqt3bd97bktr33ghenlptk.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/adexchange.seller.readonly&access_type=offline

这篇关于错误:尝试使用oauth获取access_token时,redirect_uri_mismatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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