googleappengin上google登录认证令牌的后端验证问题

2024-10-01 22:41:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将Google登录集成到我的iOS应用程序中。我可以在我的应用程序中显示登录按钮,并在成功登录后获得设备身份验证令牌。在

我的后端运行在googleappengine上。我正在将设备身份验证令牌发送到后端,并尝试使用https://developers.google.com/identity/sign-in/ios/backend-auth中的示例代码验证令牌。在

但是,当后端尝试执行时,我遇到了post末尾显示的错误client.verify_id_令牌以验证令牌。在

日志中的错误如下。对Stackoverflow的一些搜索表明,如果我启用pyOpenSSL,这个问题就会消失。我该怎么做?在

还有一个问题可能是这次失败的根本原因。在https://developers.google.com/identity/sign-in/ios/backend-auth中的代码中,我需要为CLIENT_ID和IOS_CLIENT_ID字段使用什么值?在

目前,我使用的是开发人员控制台-->;API&Auth-->;凭据-->OAuth 2.0客户端ID-->iOS client for下面列出的客户端IDcom.apm.smartiothome.聊天时间。这是对的吗?另外,是否需要在开发人员控制台中选中此旁边的复选框?在

在GAE日志中发现的错误

Encountered unexpected error from ProtoRPC method implementation: NotImplementedError (X509 certs are not supported by the PyCrypto library. Try using PyOpenSSL if native code is an option.)
Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/endpoints-1.0/endpoints/api_config.py", line 1332, in invoke_remote
    return remote_method(service_instance, request)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0/protorpc/remote.py", line 414, in invoke_remote_method
    response = method(service_instance, request)
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/apns_server.py", line 274, in registerDevice
    if(self._validateAuthToken(rcvdDeviceAuthToken,rcvdDeviceAuthType,rcvdUserID)):
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/apns_server.py", line 181, in _validateAuthToken
    idinfo = client.verify_id_token(rcvdDeviceAuthToken, CLIENT_ID)
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/oauth2client/util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/oauth2client/client.py", line 1012, in verify_id_token
    return crypt.verify_signed_jwt_with_certs(id_token, certs, audience)
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/oauth2client/crypt.py", line 338, in verify_signed_jwt_with_certs
    verifier = Verifier.from_string(pem, True)
  File "/base/data/home/apps/s~chatimegae/v1.388848915040088794/oauth2client/crypt.py", line 190, in from_string
    'X509 certs are not supported by the PyCrypto library. '
NotImplementedError: X509 certs are not supported by the PyCrypto library. Try using PyOpenSSL if native code is an option.

Tags: appsinpyclienthomedatabaseline

热门问题