Skip to content

signInWithGoogle method missing #1

Open

Description

@jalakoo

Got this compiler error from the loginpage.dart:

lib/loginpage.dart:110:57: Error: The method 'signInWithGoogle' isn't defined for the class 'firebase_auth::FirebaseAuth'.
Try correcting the name to the name of an existing method, or defining a method named 'signInWithGoogle'.
FirebaseAuth.instance.signInWithGoogle

Changing the code on line 109:

// From
FirebaseAuth.instance.signInWithGoogle(idToken: googleuser.idToken, accessToken: googleuser.accessToken).

// To
FirebaseAuth.instance.signInWithCustomToken(token: googleuser.idToken).

Allows the app to compile, but not sure if this the desired alternative and have yet to test on a device.

Activity

  1. ginuxone commented on May 4, 2019

    @ginuxone

    Following the firebase_auth you should be using

    final AuthCredential credential = GoogleAuthProvider.getCredential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken,
    );

    final FirebaseUser user = await _auth.signInWithCredential(credential);
    print("signed in " + user.displayName);

    Instead of:

    FirebaseAuth.instance.signInWithGoogle(idToken: googleuser.idToken, accessToken: googleuser.accessToken).

  2. Batzee commented on Apr 18, 2020

    @Batzee

    But now its again changed and the code will have an additional step, instead of the Firebase user, we get AuthResults, we have to extract the FirebaseUser from that

    final AuthCredential credential = GoogleAuthProvider.getCredential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); AuthResult authResults = await _auth.signInWithCredential(credential); FirebaseUser user = authResults.user;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions