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

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?



Solution 1:[1]

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

firebase login --reauth

Solution 2:[2]

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

Solution 3:[3]

In my case that it couldn't list my firebase projects, I try to access firebase by vpn that I was installed on my system (not my browser), and it worked. Then I could initial firebase in my project as hosting and deploy it.

Solution 4:[4]

for Who don't want to logout, the below command also work

firebase login --reauth

First go to command prompt and run below code then execute above code. In Command Prompt:

Run : powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Balasubramanian S
Solution 2 Peter Ochieng
Solution 3 Pouria
Solution 4