flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.18k stars 26.65k forks source link

Only Id Token is null while signing via Android , IOS is working fine. #147494

Open thufail14 opened 2 weeks ago

thufail14 commented 2 weeks ago

Steps to reproduce

  1. Click on the sign in button via an android phone.
  2. Returning only ID token as null.

Expected results

  1. Need to return the ID Token

Actual results

  1. Returning the ID Token as null.

Code sample

Code sample Future handleSignIn() async { try { _googleSignIn.disconnect(); final GoogleSignInAccount? account = await _googleSignIn.signIn(); bool isAuthorized = account != null; log('onCurrentUserChanged....... $account'); if (isAuthorized) { log('onCurrentUserChanged isAuthorized ${account.id} ${account.email}'); GoogleSignInAuthentication googleSignInAuthentication = await account.authentication; // Access token String? accessToken = googleSignInAuthentication.accessToken; log('Access Token: $accessToken'); // You can also get the ID token String? idToken = googleSignInAuthentication.idToken; log('ID Token: $idToken'); } } catch (error) { log('handleSignIn Error: $error'); } }

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [Paste your output here] ```
danagbemava-nc commented 2 weeks ago

Hi @thufail14, can you try https://github.com/flutter/flutter/issues/20903#issuecomment-1735878336 to see if it works for you? If it does not, can you share how you setup your project for google sign in?