Skip to content

Server auth token returning null everytime with new Google Sign In package #57741

@agharshit08

Description

@agharshit08

I am trying to fetch the server auth token this way but I am getting null as output everytime, I have setup the client ID with google developers console but still things are not working fine. How can I retrieve the token which I have to send to backend?

void connectWithGoogleFit() async {
    final GoogleSignIn googleSignIn = GoogleSignIn(
        scopes: <String>[
          'email',
          'https://www.googleapis.com/auth/fitness.activity.read',
        ]);
    final GoogleSignInAccount googleUser = await googleSignIn.signIn();
    final GoogleSignInAuthentication googleSignInAuthentication =
        await googleUser.authentication;
    String serverAuthToken = googleSignInAuthentication.serverAuthCode;
    print('token');
    print(serverAuthToken);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions