Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 873
skwny Avatar asked Dec 09 '16 08:12

skwny


People also ask

Does Firebase Auth use OAuth?

Firebase Authentication integrates tightly with other Firebase services, and it leverages industry standards like OAuth 2.0 and OpenID Connect, so it can be easily integrated with your custom backend.

Is Firebase Auth completely free?

Prices are per successful verification. On the Blaze plan, Phone Authentication provides a no-cost tier. The first 10K verifications for both instances (USA, Canada, and India and All other countries) are provided at no cost each month. You are only charged on usage past this no-cost allotment.


1 Answers

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

like image 72
Witek Avatar answered Oct 09 '22 18:10

Witek