Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: authStateChange never fires.

See original GitHub issue

Plugin(s):@capacitor-firebase/authentication”: “^0.5.0”

Platform(s): Android

Current behavior: When using const result = await FirebaseAuthentication.signInWithGoogle() for example, the login is successful and result.user is returned. However, authStateChange is never fired. Note that this works in web, but NOT on Android.

Expected behavior: authStateChange needs to be fired on any change in auth state, e.g. re-opening app or signing out.

Steps to reproduce:

Related code:

  // capacitor.config.json
  "plugins": {
    "FirebaseAuthentication": {
      "skipNativeAuth": false,
      "providers": ["", "", ""]
// main.ts
import { FirebaseAuthentication } from "@capacitor-firebase/authentication";
FirebaseAuthentication.removeAllListeners().then(() => {
  FirebaseAuthentication.addListener("authStateChange", (result) => {
    if (result.user) {
      // this never fires
    } else {
      // this never fires
  // Login.vue
  const signInWithGoogle = async () => {
    try {
      const result: SignInResult = await FirebaseAuthentication.signInWithGoogle();

      if (result.user) {
        return result.user;
    } catch (err) {

Other information: Some potentially relevant logs from Android Studio:

V/Capacitor/FirebaseAuthenticationPlugin: Notifying listeners for event authStateChange D/Capacitor/FirebaseAuthenticationPlugin: No listeners found for event authStateChange V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 81763094, pluginId: FirebaseAuthentication, methodName: addListener V/Capacitor: callback: 81763094, pluginId: FirebaseAuthentication, methodName: addListener, methodData: {“eventName”:“authStateChange”}

Also, it looks like there’s a similar issue that was closed but with no real solution,

Capacitor doctor:

Latest Dependencies:

  @capacitor/cli: 3.6.0
  @capacitor/core: 3.6.0
  @capacitor/android: 3.6.0
  @capacitor/ios: 3.6.0

Installed Dependencies:

  @capacitor/cli: 3.4.3
  @capacitor/core: 3.4.3
  @capacitor/android: 3.4.3
  @capacitor/ios: 3.4.3

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:41 (16 by maintainers)

github_iconTop GitHub Comments

robingenzcommented, Aug 2, 2022

I will look at it again and possibly consult with the Capacitor team to see what solution they recommend.

robingenzcommented, Aug 28, 2022

@Guiditox Thank you for testing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase onAuthStateChanged listener never fires on ...
Fairly experienced with Firebase, encountering a strange and unintuitive bug. I've written a Firebase authentication wrapper using the React ...
Read more >
auth package - JavaScript API reference - Firebase - Google
Adds a blocking callback that runs before an auth state change sets a new user. ... It also makes it easier to never...
Read more >
Using Firebase Authentication - FlutterFire
Warning: idTokenChanges() , userChanges() & authStateChanges() will not fire if you update the User profile via your own firebase admin sdk implementation.
Read more >
firebase_auth | Flutter Package -
FIX: stop authStateChange firing twice for initial event (#4099). ... 0.8.2+1 #. Fixed bug where PhoneCodeAutoRetrievalTimeout callback was never called.
Read more >
Implementing authentication in Next.js with Firebase
onAuthStateChanged(authStateChanged); return () => unsubscribe(); } ... is created in Firebase") router.push("/logged_in"); }) .catch(error ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found