mercredi 28 novembre 2018

Firebase providing an invalid Web API Key (API key not valid. Please pass a valid API key)

I've run into an ongoing issue with Firebase authentication.

TL;DR The firebase CLI tool appears to generate a new API key each time a command to display one is run, invalidating any previous keys, even if they are in use.

There seems to be multiple ways to generate an API key for use with firebase:

  • The most obvious is on their website, under Project Settings, where it displays a Web API Key
  • Another is via the firebase-tools CLI command firebase setup:web
  • A third is also via firebase-tools, using firebase login:ci - which provides a Token to be used for CI deploys

The Problem is, if/when you run the firebase setup:web or firebase login:ci commands, it seems to generate a NEW API key each time they are run, and invalidates all other keys at the same time -- including the Web API Key shown on the website.

In particular, I ran into this problem trying to use firebase-authentication wherein I started receiving API key not valid. Please pass a valid API key. on my production system without any code changes, apparently simply because I ran the firebase setup:web command.

Additionally, the website DOES NOT UPDATE with the new key. So there appears to be no way to determine what the currently valid API key is if in the future you wish to add another app to an existing project. It still shows a, now invalid, API key.




Aucun commentaire:

Enregistrer un commentaire