我编写了一个使用的移动应用程序。
此应用程序使用谷歌的OAuth 2.0端点来授权对Google的访问。
我跟随文献资料来实现这个功能。
几个月来,我一直能够通过发出以下HTTP请求来检索访问令牌和刷新令牌:
HTTP获取检索授权代码的请求:
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请求将授权代码交换为访问令牌:
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请求现在在响应中得到以下错误:
错误:
"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日突然浮出水面。
我的代码没有变化。
有人知道为什么我现在会犯这个错误吗?
发布于 2018-09-16 02:29:37
删除电子邮件范围如何?
我想谷歌现在已经修好了。我可以登录,而不删除电子邮件范围,现在我的应用程序。
https://stackoverflow.com/questions/52319770
复制相似问题