0
votes

I am developing a chrome extension which would require login before using that extension any further. I am using Firebase Authentication service to authenticate user to my extension. But something is not working out here.

A user will enter email and password that will use firebase to authorize. I am using it like this.

    firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
    // Handle Errors here.
    var errorCode = error.code;
    var errorMessage = error.message;
    console.log(error);
    // ...
    });

Everything is working fine but when I try to invoke sign in it return some error in background page.

   code:"auth/internal-error"
   message: "{"error":{"errors":
   [{"domain":"usageLimits","reason":"keyExpired","message":"Bad 
   Request"}],"code":400,"message":"Bad Request"}}"

Also this :

   www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=AIzaSyCI3pO1QSw_ciZy_Wd0CePyTlFwbUZV340 Failed to load resource: the server responded with a status of 400 ()

Here is my firebase config:

    var firebase_config = {
    apiKey: "<api-key>",
    authDomain: "<domain>",
    databaseURL: "<db-url>",
    projectId: "<project-id>",
    storageBucket: "example.appspot.com",
    messagingSenderId: "5111111111"
    };
    firebase.initializeApp(firebase_config);

I am invoking all the firebase related functions inside background.js page. Don't what is not working out here. Please let me know if I am making anything wrong here.

1
I set this up successfully a while ago, following this quickstart: github.com/firebase/quickstart-js/tree/master/auth/… - Frank van Puffelen
I followed this but do I need to publish my extension first to get this wroking ? - Abhinay Pandey
Nope. I never published it, just ran it locally. I'm not sure what's going wrong, but admit that it's been almost a year since I did this. Maybe someone else can spot the problem. - Frank van Puffelen
If I am not using google to authenticate then I don't think there is any need of adding google client id to manifest as given in firebase example. - Abhinay Pandey
There seems to be a problem with your API key. Did you generate it manually? or did you set some limitations on it? - bojeil

1 Answers

0
votes

Fixed the issue. There were some mistakes from my end in properly configuring firebase. It's working now after some tweaks.