googleSSO method
Implementation
Future<Map<String, dynamic>> googleSSO(String token, String backend,
String clientId, List<String> scopes, Map body) async {
GoogleSignIn googleSignIn = GoogleSignIn(
scopes: [
'email',
],
);
if (kIsWeb || Platform.isAndroid) {
googleSignIn = GoogleSignIn(
scopes: [
'email',
],
);
}
if (Platform.isIOS || Platform.isMacOS) {
googleSignIn = GoogleSignIn(
clientId: clientId,
scopes: [
'email',
],
);
}
GoogleSignInAccount? googleAccount;
try {
googleAccount = await googleSignIn.signIn().catchError((onError) => null);
} catch (e) {
// print(e);
}
if (googleAccount != null) {
final GoogleSignInAuthentication googleAuthentication =
await googleAccount.authentication;
return {'token': googleAuthentication.accessToken};
}
return {"token": "", "success": false};
}