Google App Engine上的Google登录身份验证令牌的后端验证问题

问题描述 投票:0回答:0

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

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

但是,当后端尝试执行client.verify_id_token验证令牌时,我遇到了帖子结尾处显示的错误。

日志中的错误如下。 在Stackoverflow上进行的一些搜索表明,如果启用pyOpenSSL,问题将消失。 我该怎么做呢?

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

当前,我正在com.apm.smartiothome.chatime的开发人员控制台-> APIs和Auth->凭据-> OAuth 2.0客户端ID-> iOS客户端下列出客户端ID。 这个对吗? 另外,我是否需要在开发人员控制台中选中此复选框旁边的复选框?

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.
python ios google-app-engine google-signin pyopenssl
© www.soinside.com 2019 - 2024. All rights reserved.