firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 943 forks source link

firebase CLI auth error in 13.13.1 #7429

Closed solarpush closed 4 months ago

solarpush commented 4 months ago

[REQUIRED] Environment info

13.13.1 firebase-tools:

Platform: windows

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Well i have finaly re-install the 13.13.1 firebase-tools package and it's all. I seen it's an authentication issue.

all commande fails:

[REQUIRED] Expected behavior

Get project information

[REQUIRED] Actual behavior

{"error":{"code":401,"message":"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.","status":"UNAUTHENTICATED"}}

Debug log

[debug] [2024-07-10T19:28:20.764Z] ----------------------------------------------------------------------
[debug] [2024-07-10T19:28:20.766Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\pierr\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js use dev --debug
[debug] [2024-07-10T19:28:20.766Z] CLI Version:   13.13.1
[debug] [2024-07-10T19:28:20.767Z] Platform:      win32
[debug] [2024-07-10T19:28:20.767Z] Node Version:  v20.11.0
[debug] [2024-07-10T19:28:20.767Z] Time:          Wed Jul 10 2024 21:28:20 GMT+0200 (heure d’été d’Europe centrale)
[debug] [2024-07-10T19:28:20.767Z] ----------------------------------------------------------------------
[debug] 
[debug] [2024-07-10T19:28:20.823Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2024-07-10T19:28:20.824Z] > authorizing via signed-in user (pierre-ext@neosilver.fr)
[debug] [2024-07-10T19:28:20.829Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/neosilver-back-dev [none]
[debug] [2024-07-10T19:28:20.958Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/neosilver-back-dev 401
[debug] [2024-07-10T19:28:20.958Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/neosilver-back-dev {"error":{"code":401,"message":"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.","status":"UNAUTHENTICATED"}}
[debug] [2024-07-10T19:28:20.959Z] 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.
[error] 
[error] Error: Invalid project selection, please verify project dev exists and you have access.
google-oss-bot commented 4 months ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

aalej commented 4 months ago

Hey @solarpush. I think you meant to run the firebase projects:list command. I tried running firebase projects:list using firebase-tools v13.3.1 and no errors were raised.

If you’re still encountering issues, could you try running firebase projects:list --debug and share the firebase-debug.log with us? Passing the --debug flag provides a more detailed log that we can use to check what caused the error.

solarpush commented 4 months ago

Hello, I'm sorry for this empty issue, this morning I worked and it happened when I had no time to explain. So I tried again and everything's fine... I think it's because I have a script that updates firebase-tools every time I launch the emulator and maybe npm i -g firebase-tools got an error. I remember to --debug for last issue and add directly in Issue. Thanks for you time.

solarpush commented 4 months ago

@aalej I reopen finally I have a time now to help you to reproduce if you have time too.

joehan commented 4 months ago

Hi @solarpush - can you try running firebase login --reauth and then retrying the failing commands?

solarpush commented 4 months ago

Hi @solarpush - can you try running firebase login --reauth and then retrying the failing commands?

Yes i have try to : Login:use ... and not working Login:ci not working

But login --reauth have worked

solarpush commented 4 months ago

@joehan @aalej thanks you The command : 'Firebase login --reauth' solve the problem for the moment i try this morning all use cases i need but the project switching work properly now with the 13.13.1 version

solarpush commented 4 months ago

Informations for reproduce it : npm i -g firebase-tools@13.13.0 firebase use "project-name" (work) npm i -g firebase-tools@13.13.1 firebase use "project-name" (not work )

firebase login --reauth firebase use "poject-name" (work)

if-fi commented 4 months ago

I'm running into the same problem. We use firebase-tools appdistribution in our CI. Our CI jobs started failing with 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. on v@13.13.1.

We pinned the version to @13.13.0 and everything works fine.

klausmyrseth commented 4 months ago

Just to verify, the version upgrade give me just short time on the token for every reauth so I am downgrading myself to previous version which worked flawlessly.

After the downgrade it works without even reauthenticating, so there is something fishy going on.

Gbuomprisco commented 4 months ago

Also running into the same issue. It works after re-authenticating, and then it does not.

joehan commented 4 months ago

Hey all, we made some changes in this past release to better support auth on idx.google.com that I suspect are the cause of this issue. I'm actively working on a fix for this to go out ASAP - in the interim, please either downgrade to 13.13.0 or run firebase login --reauth

Sorry for the inconvience!

joehan commented 4 months ago

We've just released 13.13.2, which should fix this issue. If you continue to see problems, please open a new issue to let us know.

solarpush commented 4 months ago

Re @joehan , I worked today on the 13.13.1 package and experienced several disconnections when launching the emulator or other operations. It's possible that I'm using firebase use "project" in different folders and subfolders from the terminal. This wasn't a problem before, but I have the impression that the context is lost when changing path when starting the emulator. If that can help you. thanks