场景
我想... 传递来自Andorid Native应用的认证,该认证是通过 FirebaseAuth 在我的应用程序中嵌入htmljavascript屏幕作为webview,这样我就可以调用我的firebase数据库,而不要求用户重新登录。
我的尝试 我尝试用以下方法登录 用自定义标记登录 并使用从 getidtokenresult 引起错误 "INVALID_CUSTOM_TOKEN"。
任何指导将是有益的
您可以使用Firebase Admin SDK在您的Native应用程序生成一个有效的令牌为您的客户端应用程序使用与 signInWithCustomToken()
代币生成。
//The uid should uniquely identify the user or device you are authenticating
String uid = "some-uid";
String customToken = FirebaseAuth.getInstance().createCustomToken(uid);
// Send token back to client
在客户端应用中使用。
firebase.auth().signInWithCustomToken(token).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
关于这方面的更多信息,请参见 Firebase文档