Skip to content

Undefined class 'OAuthCredential'. Try changing the name to the name of an existing class, or creating a class with the name 'OAuthCredential'. #1143

Open
@hammadkhandev

Description

@hammadkhandev

[REQUIRED] Describe your environment

  • Windows 10
  • Flutter 3.29.3 • channel stable
    *firebase_core: ^3.13.0
    *firebase_auth: ^5.5.2
    *google_sign_in: ^6.3.0
    *firebase_database: ^11.3.5

[Undefined class 'OAuthCredential'.

Try changing the name to the name of an existing class, or creating a class with the name 'OAuthCredential'.

Steps to reproduce:

Relevant Code:

https://stackblitz.com/fork/firebase-issue-sandbox

 Future<User?> signInWithGoogle() async {
  try {
    final GoogleSignInAccount? googleUser = await googleSignIn.signIn();
    final GoogleSignInAuthentication googleAuth = await googleUser!.authentication;
    final OAuthCredential credential = GoogleAuthProvider.credential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );
    final UserCredential userCredential = await _auth.signInWithCredential(credential);
    return userCredential.user;
  } catch (e) {
    print("Error signing in with Google: $e");
    return null;
  }
}

Image

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