gpt4 book ai didi

oauth-2.0 - 无法再获取 OAuth2 访问 token : invalid_scope error

转载 作者:行者123 更新时间:2023-12-04 16:04:30 31 4
gpt4 key购买 nike

我已经使用 React Native Framework 编写了一个移动应用程序。

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

我关注了 the documentation来实现这一点。

通过发出以下 HTTP 请求,我已经能够检索访问 token 和刷新 token 几个月了:

检索授权码的 HTTP GET 请求:

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');

用于交换访问 token 的授权码的 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#]}"

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

截至 2018 年 9 月 12 日,此错误突然出现。

我的代码没有任何变化。

有没有人对我现在收到此错误的原因有任何想法?

最佳答案

删除电子邮件范围怎么样?

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

关于oauth-2.0 - 无法再获取 OAuth2 访问 token : invalid_scope error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52319770/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com