问题描述
我正在使用 Flutter 和 Parse Server 开发一个应用程序,我想从 google 帐户注册用户。
我试过了:
static Future<void> loginWithGoogle() async {
try {
final _googleSignIn = GoogleSignIn(scopes: ['email','https://www.googleapis.com/auth/contacts.readonly']);
final account = await _googleSignIn.signIn(); // I figure out that the real error is here;
final authentication = await account.authentication;
final googleAuth = google(_googleSignIn.currentUser.id,authentication.accesstoken,authentication.idToken);
final response = await ParseUser.loginWith('google',googleAuth);
if (response.success) {
print(response);
//currentUser = await ParseUser.currentUser(customUserObject: User.clone());
//Get.offNamed('/oauth');
}
} catch (e) {
print(e);
AlertUtils.showErrorDialog(e.toString());
}
}
插件:PlatformException(sign_in_Failed,com.google.android.gms.common.api.ApiException: 10:,null)
解决方法
如果没有在 Firebase 上注册,您就无法做到这一点。官方 documentation 是这么说的。