Skip to content

[google_sign_in] ServerAuthCode returns null for iOS #110099

@chowdud

Description

@chowdud

In addition to basic sign in, I've been using the Google Sign In package for gaining access to additional scopes on the user such as 'https://www.googleapis.com/auth/userinfo.email' and 'https://www.googleapis.com/auth/adwords'. I am successfully able to obtain the ServerAuthCode on Android, however when the same piece of code outlined below is executed on iOS, I am receiving a null value.

I am currently still using the "Info.plist and GoogleServices.plist" method to pass in the various Google credentials into app. The client ID used is one that was "auto created by the Google Service".

Expected results:
Upon selecting an account to authenticate and consenting to some scopes, a ServerAuthCode is generated, which is sent to a backend API endpoint for further operations.

Actual results:
After selecting an account and consenting to the scopes, the ServerAuthCode returns as null, which subsequently makes operations in the backend API endpoint fail.

await googleSignIn.signOut();
final googleSignInAccount = await googleSignIn.signIn();

print(googleSignInAccount.serverAuthCode);

final linking = await http.post(
    Uri.parse(''),
    headers: {
      'Authorization': currentJwtToken
    },
    body: {
      "servertoken": googleSignInAccount.serverAuthCode,
      "email": currentUserEmail,
      "accessToken": "",
      "code": "",
      "redirect_uri": ""
    });

print(linking.body);

return jsonDecode(linking.body);

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: first hourThe first hour of using Flutterfound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions