我正在开发一个使用firebase的google sign in的登录系统,我已经做了文档中提到的一切,我仍然无法登录。我猜在try and catch块中有问题。代码在此行停止运行,并在catch块中结束。
GoogleSignInAccount account = task.getResult(ApiException.class);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
progress.show();
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
// Google Sign In failed, update UI appropriately
// Log.w(TAG, "Google sign in failed", e);
Toast.makeText(this, "Failed Sign in", Toast.LENGTH_SHORT);
// ...
}
}
}发布于 2019-07-19 02:05:31
我认为您在使用Firebase Gmail身份验证时错过了一些配置。我在下面提到了工作中的Github存储库。它将帮助你让你的代码正常工作。
Github存储库
提交Gmail身份验证提交。
关于Firebase 身份验证的谷歌博客文章
https://stackoverflow.com/questions/57099818
复制相似问题