Google登录失败-Firebase [英] Google Sign In Failed - Firebase
问题描述
I followed this tutorial and in this part of the code:
@Override
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) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = result.getSignInAccount();
firebaseAuthWithGoogle(account);
} else {
// Google Sign In failed
Log.e(TAG, "Google Sign In failed.");
Toast.makeText(SignInActivity.this,"Google Sign In Failed.",Toast.LENGTH_SHORT).show();
}
}
}
我的Google登录失败.我不知道怎么解决?
I am getting a google sign in failed. I do not know what is wrong how to fix?
我实际上是在尝试运行app-released.apk而不是直接在手机上运行时开始工作的.
I actually got in working when I tried running app-released.apk instead of running in directly on my phone.
推荐答案
在已连接的iOS和 网络应用程序.要为您的Android应用设置Google登录,您需要 在项目设置"中为每个应用添加SHA1指纹.
Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.
有关使用keytool获取签名证书的SHA哈希的信息,请参见此页面
See this page for information on using keytool to get the SHA hash of your signing certificate
https://developers.google.com/android/guides/client-auth
转到项目-设置-常规以添加指纹.
Go to Project - Settings - General to add the fingerprint.
要获取SHA1调试指纹(如果要调试,则只需要一个):
To get the SHA1 debug fingerprint (if you are debugging you only need this one):
keytool.exe -list -alias androiddebugkey -keystore C:\Users\<username>\.android\debug.keystore -storepass android -keypass android
要获取SHA1发布指纹:
To get the SHA1 release fingerprint:
keytool -exportcert -list -v -alias <MYKEYNAME> -keystore C:\mykeylocation\keystore.jks
这篇关于Google登录失败-Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!