Google API OAuth2.0 quickstart.py [英] Google API OAuth2.0 quickstart.py

查看:149
本文介绍了Google API OAuth2.0 quickstart.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Google API中提供的Quickstart.py代码示例时,出现此错误.关于为什么会产生此错误的任何想法? 链接: https://developers.google.com/google-apps/calendar/quickstart/python (我已经更新了oauth2cilent模块)

When I use Quickstart.py code sample given in Google API, I am getting this error. Any thoughts as to why this error is generated ? link:https://developers.google.com/google-apps/calendar/quickstart/python (I have already updated oauth2cilent module)

/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/_helpers.py:255: UserWarning: Cannot access 
storage.json: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Traceback (most recent call last):
File "/home/akhil/Desktop/TIME_SCHEDULE_UPDATER/quickstart.py", line 
16, in <module>
flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
File "/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/client.py", line 2134, in 
flow_from_clientsecrets
cache=cache)
File "/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/clientsecrets.py", line 165, in loadfile
return _loadfile(filename)
File "/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/clientsecrets.py", line 126, in _loadfile
return _validate_clientsecrets(obj)
File "/home/akhil/anaconda2/lib/python2.7/site-
packages/oauth2client/clientsecrets.py", line 101, in 
_validate_clientsecrets
prop_name, client_type))
oauth2client.clientsecrets.InvalidClientSecretsError: Missing property 
"redirect_uris" in a client type of "web".

推荐答案

在client_secret.json文件中,最后添加 redirect_uris 块. 您的文件应类似于: {"web":{"client_id":"foo","project_id":"bar","auth_uri":"foo","token_uri":"bar","auth_provider_x509_cert_url":"foo","client_secret": "bar","redirect_uris":" http://domain_name _where_you_want_to_redirect/"}}

In your client_secret.json file add redirect_uris block at the end. Your file should be like: {"web":{"client_id":"foo","project_id":"bar","auth_uri":"foo","token_uri":"bar","auth_provider_x509_cert_url":"foo","client_secret":"bar", "redirect_uris":"http://domain_name _where_you_want_to_redirect/"}}

这篇关于Google API OAuth2.0 quickstart.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆