skwny
skwny

Reputation: 3140

Why does Firebase auth work for Chrome but not Firefox?

Firebase onAuthStateChanged() is returning user credentials in Chrome, but not in Firefox:

enter image description here

What is the likely reason(s) for this?

Update: Here is the minimum code needed to reproduce the issue:

var firebase = require("firebase/app"),
  C = require("./constants.js");
require("firebase/auth");

firebase.initializeApp(C.FIREBASE_CONFIG);

firebase.auth().onAuthStateChanged(function(user) { 
    console.log('user is ' + user);
})

I have a lot more code in my app but after stripping everything out, this is the only code running and the issue still occurs:

enter image description here

Upvotes: 13

Views: 3109

Answers (2)

robin
robin

Reputation: 138

I had the same problem when using firebaseui, and could solve it with @idontknow s comment. Use the signin with popup method. In firebaseui this was in firebaseui.auth.Config the property signInFlow: 'popup'

Upvotes: 1

Witek
Witek

Reputation: 6462

Perhaps you have enabled Enhanced Tracking Protection in your Firefox.

It needs to be disabled for the site or globally for Firebase Authentication to work. If Enhanced Tracking Protection is enabled, onAuthStateChanged is called with null, even when you authenticated successfully.

See Firefox documentation for configuration: https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop

Upvotes: 8

Related Questions