Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Invalid API key

I have an android project which I want to expand with Firebase. Currently I've got an error logging when I want to test a crash with a log message.

Server did not receive report: Origin Error message: API key not valid. Please pass a valid API key.

What can I do to fix this? I've copied the google-services.json file to my project from the console.

like image 304
Francesco verheye Avatar asked Apr 06 '17 09:04

Francesco verheye


People also ask

How do I fix Invalid API key?

If you see an error message that reads ERROR: Invalid API key during checkout, follow these steps: Go to Wordpress > Printful > Settings. Delete the Printful Store API Key and click Save changes. Go to your Dashboard and click Connect.

Is Firebase API key sensitive?

As stated by one of the Firebase team engineers, your Firebase API key only identifies your project with Google's servers. It is not a security risk to expose it.

How do I get Firebase API key and database URL?

You can open the project in the firebase, then you should click on the project overview, then goto project settings you will see the web API Key there.


2 Answers

Got the same error in my Angular project. I know the question is for android but this is the question that pops up when I searched the error for angular so hopefully, it would help another person in the near future. Make sure you're importing the right variable. In the app.module.ts file:

import { FIREBASE } from 'src/environments/firebase';

imports: [
    AngularFireModule.initializeApp(FIREBASE.firebase)
  ],

firebase.ts (environment file) fill with your config info from firebase.

export const FIREBASE = {
  production: false,
  firebase: {
    apiKey: "",
  authDomain: "",
  databaseURL: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
  }
};

So make sure you're importing the right variable. Took me some time to figure out. Happy coding!

like image 184
thesamoanppprogrammer Avatar answered Oct 16 '22 13:10

thesamoanppprogrammer


Make sure you've got the API keys set correctly in your Google Developer Console for your Firebase project.

like image 40
Vathsav Avatar answered Oct 16 '22 14:10

Vathsav