首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何将firebase身份验证与google应用程序引擎端点集成

如何将firebase身份验证与google应用程序引擎端点集成
EN

Stack Overflow用户
提问于 2016-05-20 02:07:16
回答 1查看 2.7K关注 0票数 17

我正在为移动应用程序编写一个后端服务器。后端运行在google应用程序引擎上,并用Java编写。

我希望用户能够使用联合身份登录,如facebook。

我看到google通过firebase身份验证支持移动应用程序的这种身份验证。将firebase身份验证与我当前的应用程序引擎端点集成的最佳方式是什么?

我已经使用了云平台的数据存储,不希望使用firebase数据库,只使用身份验证方法。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2017-10-02 17:52:24

您应该能够在您的应用程序前面使用Google Cloud Endpoints作为身份验证代理。通过配置您的OpenAPI模板来配置Endpoint supports validating Firebase Authentication tokens

代码语言:javascript
复制
# Configure Firebase as an AuthN provider
securityDefinitions:
    firebase:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      # Replace YOUR-PROJECT-ID with your project ID in the issuer and audiences fields
      x-google-issuer: "https://securetoken.google.com/YOUR-PROJECT-ID"
      x-google-audiences: "YOUR-PROJECT-ID"
      x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"

# Add Firebase as an authN provider to specific endpoints...
security:
  - firebase: []

或者,您可以使用Firebase Admin SDK编写validates your tokens的身份验证中间件

代码语言:javascript
复制
FirebaseAuth.getInstance().verifyIdToken(idToken)
    .addOnSuccessListener(new OnSuccessListener<FirebaseToken>() {
        @Override
        public void onSuccess(FirebaseToken decodedToken) {
            String uid = decodedToken.getUid();
            // ...
        }
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37330997

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档