[英]How to get p12 file working on python app engine
我在使身份工具包与Python App Engine沙箱完全兼容时遇到麻烦。 提供的示例适用于非GAE沙盒项目。
在示例项目中,它使用os.path
从文件读取gitkit-server-config.json
。 但这在GAE Sandbox中不受支持。 为了解决这个问题,我直接使用构造函数创建一个GitkitClient:
gitkit_instance = gitkitclient.GitkitClient(
client_id="123456opg.apps.googleusercontent.com",
service_account_email="my-project@appspot.gserviceaccount.com",
service_account_key="/path/to/my-p12file.p12",
widget_url="http://localhost:8080/callback",
http=None,
project_id="my-project")
这是创建GitkitClient的正确方法吗?
现在的问题是,当我尝试使用dev_appserver.py
在本地运行时尝试重置密码时,得到以下堆栈跟踪:
File "dashboard.py", line 89, in post
oobResult = gitkit_instance.GetOobResult(self.request.POST,self.request.remote_addr)
File "identitytoolkit/gitkitclient.py", line 366, in GetOobResult
param['action'])
File "identitytoolkit/gitkitclient.py", line 435, in _BuildOobLink
code = self.rpc_helper.GetOobCode(param)
File "identitytoolkit/rpchelper.py", line 104, in GetOobCode
response = self._InvokeGitkitApi('getOobConfirmationCode', request)
File "identitytoolkit/rpchelper.py", line 210, in _InvokeGitkitApi
access_token = self._GetAccessToken()
File "identitytoolkit/rpchelper.py", line 231, in _GetAccessToken
'assertion': self._GenerateAssertion(),
File "identitytoolkit/rpchelper.py", line 259, in _GenerateAssertion
crypt.Signer.from_string(self.service_account_key),
File "oauth2client/_pure_python_crypt.py", line 183, in from_string
raise ValueError('No key could be detected.')
ValueError: No key could be detected.
我假设这是.p12文件的问题? 我service_account_key="/path/to/my-p12file.p12"
检查了service_account_key="/path/to/my-p12file.p12"
,该文件已存在。 我在这里想念什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.