Hi! ,
below I present a simple way to use code in flutterflow to retrieve access token to gmail api.
You can save it to local state and use it in rest api calls.
Of course, for the code to work you need to follow all the steps of firebase configuration and google login.
https://docs.flutterflow.io/data-and-backend/firebase/authentication/initial-setup
https://developers.google.com/gmail/api/guides?hl=en
import 'package:google_sign_in/google_sign_in.dart';
final _googleSignIn = GoogleSignIn(
scopes: [
'email',
'https://www.googleapis.com/auth/gmail.readonly',
],
);
Future<String?> authenticateWithGoogle() async {
final googleUser = await _googleSignIn.signIn();
final auth = await googleUser?.authentication;
return auth?.accessToken;
}