4

I'm trying to implement the Firebase E-Mail login into my Extension. From the extensions popup.html, I'm calling my login.html, which handles the process, it looks like this:

firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
          var errorCode = error.code;
          var errorMessage = error.message;
          if (errorCode === 'auth/wrong-password') {
            alert('Wrong password.');
          } else {
            console.error(error); //This produces the error quoted below
          }
        });

When I just open my login.html locally, it works. Calling it from the extensions popup makes it not work, and I get the error:

"auth/network-request-failed"

I'm assuming Chrome prevents my script from communication with the server. Is there a workaround for this? Couldn't find any solution in the docs. It is not the content security policy which does that, that I already fixed.

---- UPDATE

After Firebase now released 3.0.5, I'm getting a different error now:

"auth/too-many-requests"

ffritz
  • 2,180
  • 1
  • 28
  • 64

1 Answers1

4

The fix for this issue should be out in the next js release 3.0.5 this week. Also make sure you have probably configured your manifest.json file, use the following minimum settings:

"content_security_policy": "script-src 'self' https://apis.google.com https://www.googleapis.com https://securetoken.googleapis.com; object-src 'self'", 
"permissions": ["https://*/*","activeTab"]
Davide Icardi
  • 11,919
  • 8
  • 56
  • 77
bojeil
  • 29,642
  • 4
  • 69
  • 76
  • Thanks for reply. However, 3.0.5 leads now to a different erro: "auth/too-many-requests" – ffritz Jun 18 '16 at 13:43
  • This a security precaution to prevent abuse. You must be sending a lot of sign in requests in a short period of time. Check your network log to confirm. Try to wait a couple of minutes and try again. – bojeil Jun 18 '16 at 19:57
  • @bojeil you saved my day! I tried to authinticate with google with popup and even in the manifest.json of the [firebase sample](https://github.com/firebase/quickstart-js/tree/master/auth/chromextension) there are missing urls . – ykorach Jun 19 '17 at 18:42