[英]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.