signInWithGoogle method
Signs the user in with Google and returns the authorization token
Implementation
Future<String?> signInWithGoogle(BuildContext context) async {
await dotenv.load();
String clientId = dotenv.get('GOOGLE_CLIENT_ID_WEB');
String clientIdDesktop = dotenv.get('GOOGLE_CLIENT_ID_DESKTOP');
String redirectUri = dotenv.get('GOOGLE_REDIRECT_URI');
String authUri =
"https://accounts.google.com/o/oauth2/auth?client_id=$clientIdDesktop&redirect_uri=$redirectUri&response_type=token&scope=email";
if (kIsWeb) {
// Use Google Sign-In for Web
return _signInWithGoogleForWeb(clientId);
} else {
// Use WebView for Desktop
return _signInWithGoogleForDesktop(context, authUri, redirectUri);
}
}