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

Mar*_*ter 5 google-oauth

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

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".
Run Code Online (Sandbox Code Playgroud)

之前:

"https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile 
https://mail.google.com"
Run Code Online (Sandbox Code Playgroud)

后:

"https://mail.google.com/ 
https://www.googleapis.com/auth/userinfo.email 
https://www.googleapis.com/auth/userinfo.profile"
Run Code Online (Sandbox Code Playgroud)

据我所知,范围没有改变.之前和之后有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
Run Code Online (Sandbox Code Playgroud)

这是最后一行似乎是相关的.所以谷歌说范围发生了变化,但我无法理解为什么,或者如何解决它,因为它没有改变.

Mar*_*ter 6

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

os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] = '1'
Run Code Online (Sandbox Code Playgroud)