[英]There is an Exception in following code. Oauth login with google-firebase in flutter
When I try to log in with google the following exception is raised. 当我尝试使用google登录时,出现以下异常。
PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null).
How to solve this exception. 如何解决这个异常。 I am stuck on this from 4 days.
我从4天开始就一直坚持下去。
final GoogleSignIn _googleSignIn = GoogleSignIn();
final FirebaseAuth _auth = FirebaseAuth.instance;
Future<FirebaseUser> _handleSignIn() async {
GoogleSignInAccount googleUser = await _googleSignIn.signIn();
GoogleSignInAuthentication googleAuth = await googleUser.authentication;
AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
FirebaseUser user = await _auth.signInWithCredential(credential);
print("signed in " + user.displayName + " " + user.email);
return user;
}
If no error in your code then your Auth is complete. 如果您的代码中没有错误,则您的身份验证已完成。 but run code after this Process https://flutter.dev/docs/deployment/android
但在此过程之后运行代码https://flutter.dev/docs/deployment/android
它可能随配置一起提供,或者google_services.json
不在正确的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.