首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法再获得OAuth2访问令牌: invalid_scope错误

无法再获得OAuth2访问令牌: invalid_scope错误
EN

Stack Overflow用户
提问于 2018-09-13 18:28:02
回答 1查看 1.4K关注 0票数 6

我编写了一个使用的移动应用程序。

此应用程序使用谷歌的OAuth 2.0端点来授权对Google的访问。

我跟随文献资料来实现这个功能。

几个月来,我一直能够通过发出以下HTTP请求来检索访问令牌和刷新令牌:

HTTP获取检索授权代码的请求:

代码语言:javascript
运行
复制
https://accounts.google.com/o/oauth2/v2/auth?scope=email%20profile%20https://www.googleapis.com/auth/youtube%20https://www.googleapis.com/auth/yt-analytics.readonly%20https://www.googleapis.com/auth/yt-analytics-monetary.readonly%20https://www.googleapis.com/auth/youtubepartner&response_type=code&client_id=OMITTED&redirect_uri=OMITTED');

HTTP POST请求将授权代码交换为访问令牌:

代码语言:javascript
运行
复制
let queryString = "code=" + authCode + "&" + "client_id=OMITTED&redirect_uri=OMITTED&grant_type=authorization_code";

fetch('https://www.googleapis.com/oauth2/v4/token', {method:'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, body: queryString})

这个POST请求现在在响应中得到以下错误:

错误:

代码语言:javascript
运行
复制
"invalid_scope"
error_description
:
"Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/youtube, https://www.googleapis.com/auth/yt-analytics.readonly, https://www.googleapis.com/auth/yt-analytics-monetary.readonly], invalid=[https://www.googleapis.com/auth/youtubepartner#]}"

同样,我已经能够使用相同的代码检索访问令牌和刷新令牌几个月了。

这个错误在2018年9月12日突然浮出水面。

我的代码没有变化。

有人知道为什么我现在会犯这个错误吗?

EN

回答 1

Stack Overflow用户

发布于 2018-09-16 02:29:37

删除电子邮件范围如何?

我想谷歌现在已经修好了。我可以登录,而不删除电子邮件范围,现在我的应用程序。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52319770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档