此Python代码中的最后一行:
from firebase_admin import credentials, initialize_app from firebase_admin import auth as firebaseAuth _cred = credentials.Certificate('common/auth/touchstone-firebase-adminsdk-4a750c3d1c53.json') tsFirebaseApp = initialize_app(_cred) decoded_token_dict = firebaseAuth.verify_id_token(id_token, tsFirebaseApp)
抛出这个堆栈跟踪&我找不到任何解释它的东西......
ERROR 2017-07-30 20:10:15,986 service.py:191] Encountered unexpected error from ProtoRPC method implementation: TransportError (('Connection aborted.', error(22, 'Invalid argument'))) Traceback (most recent call last): File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app response = method(instance, request) File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/lib/endpoints-1.0/endpoints/api_config.py", line 1331, in invoke_remote return remote_method(service_instance, request) File "/Users/dgaedcke/gcloud_tools/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/remote.py", line 414, in invoke_remote_method response = method(service_instance, request) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/ferris3/endpoints.py", line 232, in inner return_val = func(self, request, **kwargs) File "/Users/dgaedcke/dev/TouchstoneMicroservices/service_backend/user_service.py", line 80, in createOrLoadUser user, appSettings, err = processUserSignupOrSignin(access_token, request.idpProfileAtts) File "/Users/dgaedcke/dev/TouchstoneMicroservices/common/auth/login.py", line 38, in processUserSignupOrSignin firUserAsDict, err = userFromJwTokenIfValid(access_token) File "/Users/dgaedcke/dev/TouchstoneMicroservices/common/auth/login.py", line 60, in userFromJwTokenIfValid decoded_token_dict = firebaseAuth.verify_id_token(id_token) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/firebase_admin/auth.py", line 98, in verify_id_token return token_generator.verify_id_token(id_token) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/firebase_admin/auth.py", line 277, in verify_id_token audience=project_id) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/google/oauth2/id_token.py", line 115, in verify_firebase_token id_token, request, audience=audience, certs_url=_GOOGLE_APIS_CERTS_URL) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/google/oauth2/id_token.py", line 76, in verify_token certs = _fetch_certs(request, certs_url) File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/google/oauth2/id_token.py", line 50, in _fetch_certs response = request(certs_url, method='GET') File "/Users/dgaedcke/dev/TouchstoneMicroservices/lib/google/auth/transport/requests.py", line 115, in __call__ raise exceptions.TransportError(exc) TransportError: ('Connection aborted.', error(22, 'Invalid argument')) INFO 2017-07-30 20:10:15,999 module.py:832] default: "POST /_ah/spi/UserService.createOrLoadUser HTTP/1.1" 500 512 INFO 2017-07-30 20:10:15,999 module.py:832] default: "POST /_ah/api/tstone/v1/user/createOrLoadUser?prettyPrint=false HTTP/1.1" 503 196
我已正确创建服务密钥,下载并导入相关的.json配置文件,并使用凭据初始化tsFirebaseApp。 我不确定还能尝试什么?