I have written a custom function to sign in with google so that user can add events to their google calendar. It's working well on iOS but on android once I choose a google account to sign in, nothing happens. What could be wrong?
Here's the code:
// Automatic FlutterFlow importsimport '/backend/backend.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:flutter/foundation.dart';
import 'package:google_sign_in/google_sign_in.dart';Future<String?> signInWithGoogleAndroid() async {
// Add your function code here!
try {
final GoogleSignIn googleSignIn = GoogleSignIn(
clientId:
"client",
scopes: <String>[
'https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/calendar.events'
],
);
final GoogleSignInAccount? googleSignInAccount = await googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthenction =
await googleSignInAccount!.authentication;
return googleSignInAuthenction.accessToken;
} catch (error) {
print('Error Signing with google');
return null;
}
}
Google Sign in with Custom code works on iOS but fails on Android
Integrations
Publishing the app to Beta Testing and Testing it on real device.
Yes
3
3 replies