当我看到本教程并尝试运行测试代码时,Google Drive SDK Python快速入门示例
视频:https://www.youtube.com/watch?v=zJVCKvXtHtE&list=PL0FA2818902D9D123
代码:https://docs.google.com/document/d/1GD3Ee07QsqxQZ-UDTNIbMqtSu4U_servCeQsd9rCkp8/edit
我收到一个错误,它显示"ValueError: redirect_uri的值不能为None“
我谷歌了一下,我不能解决这个问题。我应该修复什么?
谢谢!
发布于 2013-03-14 19:11:36
问题很简单,actually.The应用程序接口只需要知道如何处理credential.You就可以看到已安装的应用程序,web应用程序会处理它differently.For web应用程序,授权会将用户重定向到另一个页面。对于已安装的应用程序,可能需要为其提供密钥。
因此,如果您使用的是已安装的应用程序,请更改以下代码行。
from oauth2client.client import flow_from_clientsecrets
path_to_json="client_secrets.json" # download from https://code.google.com/apis/console/
AUTH_SCOPE 'https://www.googleapis.com/auth/drive'
#redirect_uri also provided in api console.The other URI mentioned there is for web applications.
flow = flow_from_clientsecrets(Path_to_JSON,AUTH_SCOPE,redirect_uri="urn:ietf:wg:oauth:2.0:oob")`
发布于 2015-01-05 22:58:47
我也有同样的问题。我的解决方案是在代码中添加redirect_uri="urn:ietf:wg:oauth:2.0:oob"。
#Before
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE)
#After
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, redirect_uri="urn:ietf:wg:oauth:2.0:oob")https://stackoverflow.com/questions/13651876
复制相似问题