简体   繁体   中英

Flutter Google Sign In Keeps Asking for Permission

I am working with the Google Sign In auth through Firebase but each time I test the app in iOS Google keeps asking for permissions whenever I login with Google Sing In. In Android it only asks for permission once. Has anyone encountered a similar issue?

This is my Google Sign In code:

class AuthService {

signInWithGoogle() async { final GoogleSignInAccount? gUser = await GoogleSignIn().signIn();

final GoogleSignInAuthentication gAuth = await gUser!.authentication;

final credential = GoogleAuthProvider.credential(
  accessToken: gAuth.accessToken,
  idToken: gAuth.idToken,
);
await FirebaseAuth.instance.signInWithCredential(credential);

} }

I tried to find another code but none of them worked!

Please make sure that you have enabled Google authentication in firebase and is using the updated google-services.json file and GoogleService-Info.plist files.

You can make use of google_sign_in package.

Also, please add the scope when instantiating Google signin

GoogleSignIn googleSignIn = GoogleSignIn(
  scopes: [
    'email',
  ],
);

GoogleSignInAccount? gAccount = await googleSignIn.signIn();
    final credential = await gAccount!.authentication;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM