我正在为移动应用程序编写一个后端服务器。后端运行在google应用程序引擎上,并用Java编写。
我希望用户能够使用联合身份登录,如facebook。
我看到google通过firebase身份验证支持移动应用程序的这种身份验证。将firebase身份验证与我当前的应用程序引擎端点集成的最佳方式是什么?
我已经使用了云平台的数据存储,不希望使用firebase数据库,只使用身份验证方法。
谢谢。
发布于 2017-10-02 17:52:24
您应该能够在您的应用程序前面使用Google Cloud Endpoints作为身份验证代理。通过配置您的OpenAPI模板来配置Endpoint supports validating Firebase Authentication tokens:
# 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的身份验证中间件
FirebaseAuth.getInstance().verifyIdToken(idToken)
.addOnSuccessListener(new OnSuccessListener<FirebaseToken>() {
@Override
public void onSuccess(FirebaseToken decodedToken) {
String uid = decodedToken.getUid();
// ...
}
});
https://stackoverflow.com/questions/37330997
复制相似问题