Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase CLI Login Failed - Error on firebase login #8304

Open
alihamza0173 opened this issue Mar 10, 2025 · 2 comments
Open

Firebase CLI Login Failed - Error on firebase login #8304

alihamza0173 opened this issue Mar 10, 2025 · 2 comments

Comments

@alihamza0173
Copy link

alihamza0173 commented Mar 10, 2025

[REQUIRED] Environment info

Firebase CLI Version: 13.33.0
Node.js Version: v20.10.0
Linux 6.12.13-amd64

[REQUIRED] Test case

Download firebase-tools or firebase-cli and authenticate from the terminal

[REQUIRED] Steps to reproduce

Execute firebase login, firebase login --reauth, firebase login --no-localhost and basically all versions of authentication available. Including ones with login:ci

[REQUIRED] Expected behavior

The authentication should complete successfully within the terminal

[REQUIRED] Actual behavior

  • The CLI opens a browser window for authentication.
  • The browser displays the following error message:
Oops!
Firebase CLI Login Failed
The Firebase CLI login request was rejected or an error occurred. Please run firebase login again or contact support if you continue to have difficulty logging in.

Meanwhile, the terminal outputs the following logs:

Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
 
? Allow Firebase to collect CLI and Emulator Suite usage and error reporting 
information? Yes
i  To change your data collection preference at any time, run `firebase logout` and log in again. 

Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=842300911&redirect_uri=http%3A%2F%2Flocalhost%3A9005

Waiting for authentication...
[2025-03-10T15:31:09.297Z] >>> [apiv2][query] POST https://accounts.google.com/o/oauth2/token [none]
[2025-03-10T15:31:09.302Z] >>> [apiv2][body] POST https://accounts.google.com/o/oauth2/token [omitted]
[2025-03-10T15:31:09.818Z] *** [apiv2] error from fetch(https://accounts.google.com/o/oauth2/token, {"headers":{},"method":"POST","body":{"_overheadLength":543,"_valueLength":208,"_valuesToMeasure":[],"writable":false,"readable":true,"dataSize":0,"maxDataSize":2097152,"pauseStreams":true,"_released":true,"_streams":[],"_currentStream":null,"_insideLoop":false,"_pendingNext":false,"_boundary":"--------------------------774456112272132751061107","_events":{},"_eventsCount":1}}): FetchError: request to https://accounts.google.com/o/oauth2/token failed, reason: 
[2025-03-10T15:31:09.820Z] Token Fetch Error: FirebaseError: Failed to make request to https://accounts.google.com/o/oauth2/token
    at RetryOperation._fn (/home/darkreaper/.nvm/versions/node/v20.10.0/lib/node_modules/firebase-tools/lib/apiv2.js:261:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

For CI servers and headless environments, generate a new token with firebase login:ci
[2025-03-10T15:31:09.842Z] >>> [apiv2][query] POST https://auth.firebase.tools/attest [none]
[2025-03-10T15:31:09.843Z] >>> [apiv2][body] POST https://auth.firebase.tools/attest {"session_id":"0488bc1a-09e8-4374-bc7d-ea8f46f10975"}
[2025-03-10T15:31:10.856Z] <<< [apiv2][status] POST https://auth.firebase.tools/attest 200
[2025-03-10T15:31:10.857Z] <<< [apiv2][body] POST https://auth.firebase.tools/attest {"token":"jEMefqcNhsrJC0LEiByNS8ZrFqAjvarPBWTTsJuQeu0"}

To sign in to the Firebase CLI:

1. Take note of your session ID:

   0488B

2. Visit the URL below on any device and follow the instructions to get your code:

   https://auth.firebase.tools/login?code_challenge=1N6ynEeq4AgfXbKNiDvos3Lmn4m1kIJzQl0WB9bsQr8&session=0488bc1a-09e8-4374-bc7d-ea8f46f10975&attest=jEMefqcNhsrJC0LEiByNS8ZrFqAjvarPBWTTsJuQeu0

3. Paste or enter the authorization code below once you have it:

? Enter authorization code: 


@aalej
Copy link
Contributor

aalej commented Mar 11, 2025

Hey @alihamza0173, sorry to hear you're encountering this issue. Usually, we see this occur when there is a Firewall or proxy misconfiguration that is blocking the network request. To rule out the possibility that this is a network issue, could you try connecting to a different network or temporarily disabling VPN, Firewall, and proxy you may have?

Also, try running curl -X POST -I https://accounts.google.com/o/oauth2/token to see if you'd be able to make a request to that endpoint.

@aalej aalej added the Needs: Author Feedback Issues awaiting author feedback label Mar 11, 2025
@alihamza0173
Copy link
Author

hi @aalej
I was connected to my regular WiFi and was not using any VPN, proxy, or firewall while facing this issue.

I ran the suggested API request, and here is the result:

curl -X POST -I https://accounts.google.com/o/oauth2/token  
HTTP/2 400  
content-type: application/json; charset=utf-8  
vary: X-Origin  
vary: Referer  
vary: Origin,Accept-Encoding  
date: Wed, 12 Mar 2025 00:50:42 GMT  
server: scaffolding on HTTPServer2  
x-xss-protection: 0  
x-frame-options: SAMEORIGIN  
x-content-type-options: nosniff  
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000  
accept-ranges: none  

Furthermore, I had attempted logging in several times over two days, but the problem continued. Yet, I just attempted it again today, and although it failed twice, it did manage to connect successfully on the third try.

I was connected to the same network as yesterday, so there would not appear to have been any change in the network that would have influenced the result.

Please let me know if you require any additional information. Thanks!

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants