This commit is contained in:
Hillel Coren 2021-03-16 08:28:44 +02:00
parent 714c3cf696
commit ee67e177ed
1 changed files with 22 additions and 3 deletions

View File

@ -25,18 +25,37 @@ class GoogleOAuth {
callback(value.idToken, value.accessToken, value.serverAuthCode);
});
} else {
throw 'Error: sign in failed';
// throw 'Error: sign in failed';
// TODO remove this code
account ??= await _googleSignIn.signIn();
if (account != null) {
account.authentication.then((GoogleSignInAuthentication value) {
callback(value.idToken, value.accessToken, value.serverAuthCode);
});
} else {
throw 'Error: sign in failed';
}
}
}
static void signUp(Function(String, String, String) callback) async {
final account = await _googleSignIn.grantOfflineAccess();
var account = await _googleSignIn.grantOfflineAccess();
if (account != null) {
account.authentication.then((GoogleSignInAuthentication value) {
callback(value.idToken, value.accessToken, value.serverAuthCode);
});
} else {
throw 'Error: sign up failed';
// throw 'Error: sign up failed';
// TODO remove this code
account = await _googleSignIn.grantOfflineAccess();
if (account != null) {
account.authentication.then((GoogleSignInAuthentication value) {
callback(value.idToken, value.accessToken, value.serverAuthCode);
});
} else {
throw 'Error: sign up failed';
}
}
}