Skip to content

ERROR_INVALID_CREDENTIAL #40705

Closed
Closed

Description

@keinou

FirebaseUser firebaseUser = await firebaseAuth.signInWithCredential(credential);

Exception has occurred.
PlatformException (PlatformException(ERROR_INVALID_CREDENTIAL, The supplied auth credential is malformed or has expired. [ ID Token issued at 1568743895 is stale to sign-in. ], null))

My Code

final GoogleSignIn googleSignIn = new GoogleSignIn();
    final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
    GoogleSignInAccount googleUser = await googleSignIn.signIn();
    GoogleSignInAuthentication googleAuth = await googleUser.authentication;
    
    final AuthCredential credential = GoogleAuthProvider.getCredential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );

    FirebaseUser firebaseUser = await firebaseAuth.signInWithCredential(credential);

Doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [versão 10.0.18362.356], locale pt-BR)
 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[!] Android Studio (version 3.4)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.38.1)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

I use VsCode

Console

W/BiChannelGoogleApi(18295): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@1b19b86
W/DynamiteModule(18295): Local module descriptor class for com.google.firebase.auth not found.
I/FirebaseAuth(18295): [FirebaseAuth:] Loading module via FirebaseOptions.
I/FirebaseAuth(18295): [FirebaseAuth:] Preparing to create service connection to gms implementation
E/flutter (18295): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(ERROR_INVALID_CREDENTIAL, The supplied auth credential is malformed or has expired. [ ID Token issued at 1568743895 is stale to sign-in. ], null)
E/flutter (18295): #0      StandardMethodCodec.decodeEnvelope 
package:flutter/…/services/message_codecs.dart:569
E/flutter (18295): #1      MethodChannel.invokeMethod 
package:flutter/…/services/platform_channel.dart:316
E/flutter (18295): <asynchronous suspension>
E/flutter (18295): #2      FirebaseAuth.signInWithCredential 
package:firebase_auth/src/firebase_auth.dart:190
E/flutter (18295): <asynchronous suspension>
E/flutter (18295): #3      _LoginSignUpPageState._googleLogin 
package:apptesseract/pages/login_signup_page.dart:326
E/flutter (18295): <asynchronous suspension>
E/flutter (18295): #4      _InkResponseState._handleTap 
package:flutter/…/material/ink_well.dart:654
E/flutter (18295): #5      _InkResponseState.build.<anonymous closure> 
package:flutter/…/material/ink_well.dart:729
E/flutter (18295): #6      GestureRecognizer.invokeCallback 
package:flutter/…/gestures/recognizer.dart:182
E/flutter (18295): #7      TapGestureRecognizer._checkUp 
package:flutter/…/gestures/tap.dart:365
E/flutter (18295): #8      TapGestureRecognizer.acceptGesture 
package:flutter/…/gestures/tap.dart:312
E/flutter (18295): #9      GestureArenaManager.sweep 
package:flutter/…/gestures/arena.dart:156
E/flutter (18295): #10     GestureBinding.handleEvent 
package:flutter/…/gestures/binding.dart:222
E/flutter (18295): #11     GestureBinding.dispatchEvent 
package:flutter/…/gestures/binding.dart:198
E/flutter (18295): #12     GestureBinding._handlePointerEvent 
package:flutter/…/gestures/binding.dart:156
E/flutter (18295): #13     GestureBinding._flushPointerEventQueue 
package:flutter/…/gestures/binding.dart:102
E/flutter (18295): #14     GestureBinding._handlePointerDataPacket 
package:flutter/…/gestures/binding.dart:86
E/flutter (18295): #15     _rootRunUnary  (dart:async/zone.dart:1136:13)
E/flutter (18295): #16     _CustomZone.runUnary  (dart:async/zone.dart:1029:19)
E/flutter (18295): #17     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)
E/flutter (18295): #18     _invoke1  (dart:ui/hooks.dart:263:10)
E/flutter (18295): #19     _dispatchPointerDataPacket  (dart:ui/hooks.dart:172:5)

Activity

  1. escamoteur commented on Sep 18, 2019

    @escamoteur
    Contributor

    Please try to get a solution on stackoverflow first. If that doesn't help please raise a new issue at https://github.com/FirebaseExtended/flutterfire because this is a plugin bug.

  2. kroikie commented on Oct 13, 2019

    @kroikie

    @keinou

    This issue has been moved to firebase/flutterfire#1080. Any further collaboration will be done there.

  3. NavdeepSinghBhati2562 commented on May 19, 2021

    @NavdeepSinghBhati2562

    I have just restarted the Emulator and reinstalled the App and its worked for me

  4. ibrahim-demirci commented on Jun 22, 2021

    @ibrahim-demirci

    I delete my google google account on phone settings. Then I added again. It's works :)

  5. github-actions commented on Jul 31, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Jul 31, 2021
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

    d: stackoverflowGood question for Stack Overflowp: firebase_authObsolete - The Firebase Auth pluginpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions