Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将firebase身份验证与google app engine端点集成_Android_Google App Engine_Firebase_Firebase Authentication - Fatal编程技术网

Android 如何将firebase身份验证与google app engine端点集成

Android 如何将firebase身份验证与google app engine端点集成,android,google-app-engine,firebase,firebase-authentication,Android,Google App Engine,Firebase,Firebase Authentication,我正在为移动应用程序编写一个后端服务器。 后端在google app engine上运行,并用Java编写 我希望用户能够使用联合身份(如facebook)登录 我看到google通过firebase身份验证支持移动应用程序的这种身份验证。将firebase身份验证与我当前的应用程序引擎端点集成的最佳方式是什么 我已经在使用云平台的数据存储,不希望使用firebase数据库,只使用身份验证方法 谢谢。我也在寻找答案。到目前为止,我最好的5c是 使用FireBase从控制台设置登录方法等 使用F

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

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

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

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


谢谢。

我也在寻找答案。到目前为止,我最好的5c是

  • 使用FireBase从控制台设置登录方法等
  • 使用FireBase UI(测试版)进行web或使用iOS/Android的“联合身份提供程序集成”来设置身份验证流
  • 在web/iOS/Android客户端上检索令牌/身份验证详细信息,并将其作为HTTP请求头等传递给云端点
  • 将javax.servlet.http.HttpServletRequest注入到端点方法(只需添加一个参数,并使用Google自动注入请求对象)
  • 创建端点将为每个请求(需要身份验证)调用的方法,该方法将处理作为HTTP请求头传递的凭据的验证
  • 使用FireBase Java SDK调用FireBase来验证凭据(为此,您需要从FireBase控制台导出json配置)并加载SDK,例如,在您的一个servlet中:

您应该能够在应用程序前面使用身份验证代理。通过配置OpenAPI模板创建端点:

# 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: []
或者,您可以使用编写身份验证中间件:

FirebaseAuth.getInstance().verifyIdToken(idToken)
.addOnSuccessListener(新的OnSuccessListener(){
@凌驾
成功时公共无效(FirebaseToken已解码){
字符串uid=decodedToken.getUid();
// ...
}
});

我用一个类似的问题创建了一个新问题。。。看见
# 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: []
FirebaseAuth.getInstance().verifyIdToken(idToken)
    .addOnSuccessListener(new OnSuccessListener<FirebaseToken>() {
        @Override
        public void onSuccess(FirebaseToken decodedToken) {
            String uid = decodedToken.getUid();
            // ...
        }
});