How do I solve: Error: Failed to list Firebase projects. See firebase-debug.log for more info

41,240

Solution 1

Update

The fix is:

$ firebase login --reauth

Thanks to @kynan in the comments for simplifying the original two-liner down to this one-liner.

If that doesn't work, you can also try logging out and logging back in like the original answer.


Original Answer

The fix is:

$ firebase logout

$ firebase login

It looks like when you upgrade firebase-tools, that may invalidate your auth token. You just have to log out and log back in.

Here's the message when you log out:

$ firebase logout
!  Invalid refresh token, did not need to deauthorize
+  Logged out from <email>

Solution 2

For people who don't want to logout, the below command will also work.

firebase login --reauth

Solution 3

use firebase logout to log out then use firebase login to log back in to firebase in the CLI

Do this after updating the firebase tools using npm install -g firebase-tools

After succesfull login, use firebase use --add to list all the projects you have

Share:
41,240

Related videos on Youtube

Patrick
Author by

Patrick

Angular, Firebase, Material, Android. Productivity, health, finance, startups, product, SW development.

Updated on April 07, 2022

Comments

  • Patrick
    Patrick about 2 years

    So I'm minding my own business trying to initializing a Firebase project in my Angular app when all of the sudden I'm hit with this error:

    Error: Failed to list Firebase projects. See firebase-debug.log for more info.
    

    To get to that point, I followed the instructions in the documentation here which are basically run:

    $ npm install -g firebase-tools
    
    $ firebase login // Turns out I was already logged in
    
    $ firebase projects:list // Make sure you can access your account.
    

    Anyway, back to the error. "Ok," I think. "I'll just check out the log it's pointing me to." I open the log and see:

    HTTP Error: 401, Request had invalid authentication credentials. 
    Expected OAuth 2 access token, login cookie or other valid authentication credential.
    See https://developers.google.com/identity/sign-in/web/devconsole-project.`
    `FirebaseError: HTTP Error: 401, Request had invalid authentication credentials.
    Expected OAuth 2 access token, login cookie or other valid authentication credential.
    See https://developers.google.com/identity/sign-in/web/devconsole-project.`
    

    The part about "invalid authentication credentials" makes me think it has something to do with me not being logged into firebase but firebase login shows I am logged in.

    The URL in the log just takes me to the docs for using firebase auth in my app. Well, I would love to. But first I need this command to work, Firebase.

    Has anyone run into this/have a solution for it?

  • kynan
    kynan over 4 years
    Alternative: firebase login --reauth
  • Reiko Dev
    Reiko Dev almost 3 years
    @kynan thank you man, this really helped me!
  • Admin
    Admin almost 3 years
    worked to me, $ firebase logout $ firebase login
  • Brandon Pillay
    Brandon Pillay over 2 years
    After hours of searching. Thanks Patrick.
  • huykon225
    huykon225 over 2 years
    I tried but it's not working
  • Ray Oei
    Ray Oei about 2 years
    The firebase logout/login is the better option in case you have many identities.