OAuth
This commit is contained in:
parent
714c3cf696
commit
ee67e177ed
|
|
@ -20,6 +20,15 @@ class GoogleOAuth {
|
|||
|
||||
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';
|
||||
// TODO remove this code
|
||||
account ??= await _googleSignIn.signIn();
|
||||
|
||||
if (account != null) {
|
||||
account.authentication.then((GoogleSignInAuthentication value) {
|
||||
callback(value.idToken, value.accessToken, value.serverAuthCode);
|
||||
|
|
@ -28,9 +37,18 @@ class GoogleOAuth {
|
|||
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';
|
||||
// TODO remove this code
|
||||
account = await _googleSignIn.grantOfflineAccess();
|
||||
if (account != null) {
|
||||
account.authentication.then((GoogleSignInAuthentication value) {
|
||||
callback(value.idToken, value.accessToken, value.serverAuthCode);
|
||||
|
|
@ -39,6 +57,7 @@ class GoogleOAuth {
|
|||
throw 'Error: sign up failed';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<GoogleSignInAccount> signOut() async {
|
||||
return await _googleSignIn.signOut();
|
||||
|
|
|
|||
Loading…
Reference in New Issue