firebaseui-web-react: API Key not found error
Hello,
I am following the README instructions very closely but cannot get email/password authentication to work for the life of me:
import React, { Component } from "react";
import StyledFirebaseAuth from "react-firebaseui/StyledFirebaseAuth";
import firebase from "firebase";
const config = {
// Copied directly from the Firebase console...
};
firebase.initializeApp(config);
const firebaseUIConfig = {
signInOptions: [
{
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
requireDisplayName: false,
signInMethod: firebase.auth.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD
}
],
tosUrl: "https://irace.me",
privacyPolicyUrl: "https://irace.me"
};
class App extends Component {
render() {
return <StyledFirebaseAuth uiConfig={firebaseUIConfig} firebaseAuth={firebase.auth()} />;
}
}
When choosing my email address from the dropdown, I get the following error:
[ 5.887s] [firebaseui] Internal error: {"error":{"code":400,"message":"API Key not found. Please pass a valid API key.","errors":[{"message":"API Key not found. Please pass a valid API key.","domain":"global","reason":"badRequest"}],"status":"INVALID_ARGUMENT"}}
When looking at the HTTP traffic, I see that the API key is in fact present:

Any ideas? Totally stuck on this – thanks in advance!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (1 by maintainers)
In my case the issue was that I had previously created a project with the same name. Take a look here: https://console.developers.google.com/cloud-resource-manager I had 2 projects there that somehow conflicted with each other.
For me, since this was a new project, the easiest solution was to delete the entire project (in firebase AND in the cloud resource manager) and then create it from scratch.
hi guys, I figured it out without having to delete my project. The solution was “REGENERATE KEY” in the top right of the screenshot below.
Note that I also renamed my project as per @resurge , so the solution may be these two things in combination.
@mephix That’s what i think yeah. I noticed that I was using a different (new) project ID in my firebase config yet the corresponding api key for that project was Invalid. Then I tried the api key for the other project, which had the same name (but not project id) , and that worked!
So I’m suspecting this is an issue with firebase itself and not this library, but this was the highest ranking Google result for this error message so I thought it could be helpful to write my workaround here.
Yeah – I don’t know what I did here. I swear I copied it right out of the Firebase console, but alas I did end up with a weird key in there somehow. False alarm, thanks for taking a look @bojeil-google
Hey guys I was also facing very same problem and it was kind of frustrating but I solved this just go on firebase console and then go in authentication inside sign in methods scroll down to authorized domain and remove localHost:3000 as default after that you can use your firebase link easy without any problem.
It seems like the API key you are using is invalid. Perhaps you copied it incorrectly. You can also try to generating a new browser API key.