gpt4 book ai didi

google-oauth - Google oauth 范围在身份验证期间更改,但范围相同

转载 作者:行者123 更新时间:2023-12-04 20:28:13 27 4
gpt4 key购买 nike

我创建了一个需要 google 范围的应用程序,它一直工作到现在。我收到此错误:

Error
ERROR:Scope has changed from "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://mail.google.com" to "https://mail.google.com/ https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile".

前:
"https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
https://mail.google.com"

后:
"https://mail.google.com/ 
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile"

据我所知,范围没有改变。前后有3个作用域,只是顺序变了。

这里的python代码在这里:
try:
credentials = oauth.fetch_token('https://accounts.google.com/o/oauth2/token',
authorization_response = full_authorization_response_url,
client_secret=client_secret)
except Exception as e:
import traceback
print(traceback.format_exc())
credentials = 'ERROR:'+str(e)
if type(credentials) in (str,unicode):
return "Error<br>"+credentials

最后一行似乎是相关的。所以谷歌说范围改变了,但我不明白为什么,或者如何解决它,因为它没有改变。

最佳答案

我发现放宽服务器上的 token 范围解决了这个问题。除非您添加以下行,否则它显然希望以相同的顺序使用相同的范围:

os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] = '1'

关于google-oauth - Google oauth 范围在身份验证期间更改,但范围相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53176162/

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