我创建了一个需要谷歌范围的应用程序,它一直在工作.我收到此错误:
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)
这是最后一行似乎是相关的.所以谷歌说范围发生了变化,但我无法理解为什么,或者如何解决它,因为它没有改变.
我发现放宽服务器上的令牌范围解决了这个问题。除非您添加以下行,否则它显然希望以相同的顺序使用相同的范围:
os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] = '1'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
495 次 |
| 最近记录: |