firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Firebase CLI login failed

Open ApollineCos opened this issue 1 year ago • 11 comments

firebase-tools: 14.1.0

Platform: Windows 11 Professionnel

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

To connect, i followed these steps:

  1. Log out from all browsers.
  2. Using a terminal window, do: firebase logout
  3. Using a terminal window, do: firebase login --debug
  4. See: Allow Firebase to collect CLI and Emulator Suite usage and error reporting information?
  5. See: Visit this URL on this device to log in: https://accounts.google.com/o/oauth2/auth?client_id=a-very-long-url

Waiting for authentication…

  1. Copy and paste the URL (from step 5) in an incognito browser window
  2. On the browser, select the email account that has access to your Firebase project.
  3. Click Continue > Allow

[REQUIRED] Expected behavior

A message should appear in my browser: “Woohoo! Firebase CLI Login Successful You are connected to the Firebase Command-Line interface.”

[REQUIRED] Actual behavior

I get an "Oops! Fireabse CLI login failled The firebase CLI login request was rejected or an error occured. Please run "firebase login" again or contact support if you continue to have difficulty logging in."

ApollineCos avatar Apr 14 '25 07:04 ApollineCos

Hey @ApollineCos, thanks for reaching out. From what we've seen in the past, this usually occurs due to a network related issue. Try connecting to a different network or temporarily disable any proxy/firewall/VPN to rule out network issues. If you're still unable to login, could you run firebase login --debug and share with us the firebase-debug.log file? Please remove any PII before sharing the content.

It might also be worth trying to login via firebase login --no-localhost.

aalej avatar Apr 14 '25 15:04 aalej

Hey @ApollineCos. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Apr 23 '25 01:04 google-oss-bot

Hello, sorry for the delay.

I already try to connect on an another network and nothing works. I'm doesn't use VPN or proxy. I already tried with firebase login --no-localhost but still have the same isse

Here find my firebase-debug.log content :

`[debug] [2025-04-11T07:40:24.302Z] ---------------------------------------------------------------------- [debug] [2025-04-11T07:40:24.304Z] Command: firebase login --debug [debug] [2025-04-11T07:40:24.304Z] CLI Version: 14.1.0 [debug] [2025-04-11T07:40:24.305Z] Platform: win32 [debug] [2025-04-11T07:40:24.305Z] Node Version: v20.9.0 [debug] [2025-04-11T07:40:24.305Z] Time: Fri Apr 11 2025 09:40:24 GMT+0200 (heure d’été d’Europe centrale) [debug] [2025-04-11T07:40:24.305Z] ---------------------------------------------------------------------- [debug] [info] i 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 and is not used to identify you.

[info] i To change your data collection preference at any time, run firebase logout and log in again. [info] [info] Visit this URL on this device to log in: [info] [URL] [info] [info] Waiting for authentication... [debug] [2025-04-11T07:40:36.799Z] >>> [apiv2][query] POST [URL] [none] [debug] [2025-04-11T07:40:36.801Z] >>> [apiv2][body] POST [URL] [omitted] [debug] [2025-04-11T07:40:37.174Z] *** [apiv2] error from fetch([URL], {"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":"--------------------------788708185733194314541678","_events":{},"_eventsCount":1}}): FetchError: request to [URL] failed, reason: unable to get local issuer certificate [debug] [2025-04-11T07:40:37.175Z] Token Fetch Error: FirebaseError: Failed to make request to [URL] at RetryOperation._fn (apiv2.js:261:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [error] 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 [debug] [2025-04-11T07:40:37.182Z] >>> [apiv2][query] POST [URL] [none] [debug] [2025-04-11T07:40:37.182Z] >>> [apiv2][body] POST [URL] {"session_id":"[SESSION_ID]"} [debug] [2025-04-11T07:40:38.027Z] <<< [apiv2][status] POST [URL] 200 [debug] [2025-04-11T07:40:38.027Z] <<< [apiv2][body] POST [URL] {"token":"[TOKEN]"} [info] [info] To sign in to the Firebase CLI: [info] [info] 1. Take note of your session ID: [info] [info] [SESSION_ID] [info] [info] 2. Visit the URL below on any device and follow the instructions to get your code: [info] [info] [URL] [info] [info] 3. Paste or enter the authorization code below once you have it:

[debug] [2025-04-11T07:54:07.325Z] >>> [apiv2][query] POST https://accounts.google.com/o/oauth2/token [none] [debug] [2025-04-11T07:54:07.325Z] >>> [apiv2][body] POST https://accounts.google.com/o/oauth2/token [omitted] [debug] [2025-04-11T07:54:07.589Z] *** [apiv2] error from fetch(https://accounts.google.com/o/oauth2/token, {"headers":{},"method":"POST","body":{"_overheadLength":655,"_valueLength":287,"_valuesToMeasure":[],"writable":false,"readable":true,"dataSize":0,"maxDataSize":2097152,"pauseStreams":true,"_released":true,"_streams":[],"_currentStream":null,"_insideLoop":false,"_pendingNext":false,"_boundary":"--------------------------071303832442366485525767","_events":{},"_eventsCount":1}}): FetchError: request to https://accounts.google.com/o/oauth2/token failed, reason: unable to get local issuer certificate [debug] [2025-04-11T07:54:07.589Z] Token Fetch Error: FirebaseError: Failed to make request to https://accounts.google.com/o/oauth2/token at RetryOperation._fn (C:\Program Files\NVM\v20.9.0\node_modules\firebase-tools\lib\apiv2.js:261:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [error] 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 [error] [error] Error: Unable to authenticate using the provided code. Please try again.`

ApollineCos avatar Apr 23 '25 07:04 ApollineCos

Since there haven't been any recent updates here, I am going to close this issue.

@ApollineCos if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Apr 28 '25 01:04 google-oss-bot

I replied so please help me

ApollineCos avatar Apr 28 '25 07:04 ApollineCos

i have the same problem

2025-07-06T12:17:46.483Z] >>> [apiv2][query] POST https://accounts.google.com/o/oauth2/token [none] [2025-07-06T12:17:46.483Z] >>> [apiv2][body] POST https://accounts.google.com/o/oauth2/token [omitted] [2025-07-06T12:18:07.552Z] *** [apiv2] error from fetch(https://accounts.google.com/o/oauth2/token, {"headers":{},"method":"POST","body":{"_overheadLength":655,"_valueLength":287,"_valuesToMeasure":[],"writable":false,"readable":true,"dataSize":0,"maxDataSize":2097152,"pauseStreams":true,"_released":true,"_streams":[],"_currentStream":null,"_insideLoop":false,"_pendingNext":false,"_boundary":"--------------------------914382856592510405834018","_events":{},"_eventsCount":1}}): FetchError: request to https://accounts.google.com/o/oauth2/token failed, reason: connect ETIMEDOUT 173.194.174.84:443 [2025-07-06T12:18:07.553Z] Token Fetch Error: FirebaseError: Failed to make request to https://accounts.google.com/o/oauth2/token at RetryOperation._fn (C:\Users\sineava\AppData\Roaming\npm\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

Error: Unable to authenticate using the provided code. Please try again.

vrlas avatar Jul 06 '25 12:07 vrlas

I am facing the same issue, can anyone help with it ?

Adityapanther avatar Jun 20 '26 11:06 Adityapanther

Potential solution in #10692

HaydenFaulkner avatar Jun 22 '26 13:06 HaydenFaulkner

🚨 IMPORTANT UPDATE FOR EVERYONE FACING FIREBASE LOGIN ERRORS 🚨

If you are getting any of the following errors while using Firebase CLI, Flutter, Android Studio, PowerShell, or Command Prompt, then this solution may help you:

❌ Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

❌ Error: Unable to authenticate using the provided code. Please try again.

❌ Firebase CLI Login Failed

❌ Firebase Authentication Error

❌ Firebase Login Not Working

❌ Firebase Login Authorization Failed

❌ Firebase Login Session Expired

❌ Firebase Login Reauthentication Failed

❌ Firebase CLI Unable to Authenticate

❌ Firebase Login Token Expired

❌ Firebase Login Browser Authentication Failed

I personally faced this problem while configuring Firebase for my Flutter project. I spent a lot of time trying different commands, reinstalling Firebase CLI, and repeating the login process, but the issue continued. After testing multiple solutions, I finally found a working fix.

🎥 COMPLETE SOLUTION VIDEO:

👉 https://youtu.be/oP3w_OI435s?si=yBOXlHJWGEk4oO2C

Watch the video carefully and follow every step exactly as shown.

This solution may help if you are facing issues while running:

✔ firebase login

✔ firebase login --reauth

✔ firebase login --debug

✔ firebase logout

✔ firebase init

✔ firebase deploy

✔ firebase projects:list

✔ flutterfire configure

✔ npm install -g firebase-tools

Common searches that may bring you here:

firebase login error

firebase authentication error

firebase cli login failed

firebase login unable to authenticate

firebase login credentials are no longer valid

firebase login reauth not working

firebase login authorization code invalid

firebase login browser issue

firebase login powershell error

firebase login windows 11 error

firebase login windows 10 error

firebase login android studio error

firebase login flutter error

firebase deploy authentication failed

firebase init authentication failed

firebase tools login issue

firebase oauth error

firebase cli authentication failed

firebase login code rejected

firebase login token expired

firebase login session invalid

firebase login after entering authorization code error

firebase login command prompt error

firebase login stuck after browser authentication

firebase login not accepting code

firebase cli latest version login issue

firebase login 2026

firebase login fix 2026

firebase authentication solution

firebase login complete fix

⚠️ Before commenting "Not Working", please mention:

1️⃣ Your Operating System (Windows 10 or Windows 11)

2️⃣ Firebase CLI Version Run: firebase --version

3️⃣ Node.js Version Run: node --version

4️⃣ Exact Error Message

5️⃣ Screenshot of the Error (if possible)

This helps me understand the issue faster and provide a better solution.

📧 For additional assistance:

[[email protected]](mailto:[email protected])

I regularly check comments and emails and try to help developers facing Firebase, Flutter, Android Studio, Firebase CLI, Authentication, Deployment, Firestore, Hosting, and FlutterFire configuration issues.

If this solution helped you, please:

👍 Like the video

💬 Comment "Solved"

📢 Share it with other Flutter developers

🔔 Subscribe for more Firebase and Flutter tutorials

Happy Coding! 🚀

flutter-for-developers avatar Jun 23 '26 06:06 flutter-for-developers

Issue for me was the node version. Switch to node 20.20.2

venvic avatar Jun 24 '26 07:06 venvic

For me, Firebase CLI deployment was blocked because firebase login kept failing after browser authorization. The auth code was accepted in the browser, but the CLI failed during the token exchange with Google OAuth.

The issue appears to be related to the Node runtime used by the Homebrew Firebase CLI. Our default Firebase CLI was running through Node v26.3.1, and Firebase login consistently failed. Based on a known Firebase CLI issue, we installed Node v20.20.2 side-by-side using Homebrew and ran the existing Firebase CLI explicitly with Node 20.

We did not relink Node or change the global default Node version. Default Node stayed at v26.3.1.

After running Firebase CLI through Node v20.20.2, login succeeded and the deploy completed successfully for:

  • Firestore rules
  • Storage rules
  • Cloud Functions
  • Production hosting

The Node 20 install is reversible with: brew uninstall node@20

Hesamedin avatar Jun 25 '26 02:06 Hesamedin