【发布时间】:2020-08-15 21:07:04
【问题描述】:
我已经按照here 的所有步骤,我还在firebase 控制台中添加了SHA1 密钥。
这是我的代码
void handleGoogleSignIn() async {
String errorMessage = "success";
GoogleSignInAccount _googleSignInAccount = await _googleSignIn.signIn();
GoogleSignInAuthentication googleSignInAuthentication =
await _googleSignInAccount.authentication;
AuthCredential _credential = GoogleAuthProvider.getCredential(
idToken: googleSignInAuthentication.idToken,
accessToken: googleSignInAuthentication.accessToken);
try {
AuthResult _authResult = await _auth.signInWithCredential(_credential);
} catch (error) {
switch (error.code) {
case "ERROR_INVALID_CREDENTIAL":
errorMessage = "Invalid credentials";
break;
case "ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL":
errorMessage = "This accouont exists withother credentials";
break;
case "ERROR_OPERATION_NOT_ALLOWED":
errorMessage = "Signing in with Email and Password is not enabled.";
break;
default:
errorMessage = "An undefined Error happened.";
}
}
showErrorOrNavigate(errorMessage);
}
我创建了一个调试。遵循these 步骤的密钥库
异常:PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) E/flutter (30467): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7) E/flutter (30467): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33) E/颤振(30467): E/flutter (30467): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:349:48) E/flutter (30467): #3 MethodChannelGoogleSignIn.signIn (package:google_sign_in_platform_interface/src/method_channel_google_sign_in.dart:45:10)`
我找不到我的错误。
【问题讨论】:
标签: android firebase flutter google-signin