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

CLI login fails with an Error to make a request message

Open ArcherN9 opened this issue 4 years ago • 9 comments

[REQUIRED] Environment info

firebase-tools: 11.0.1

Platform: macOS {11.6.1 (20G224)}

[REQUIRED] Test case

  • Download firebase-tools or firebase-cli and authenticate from the terminal (Alacritty, default MacOS terminal, ZSH shell)

[REQUIRED] Steps to reproduce

  • Download Firebase-tools or Firebase-cli package from either npm or brew.sh respectively;
  • 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

  • CLI tool authenticates

[REQUIRED] Actual behavior

The following is the output of firebase login --debug

~ ❯ firebase login --debug
i  Firebase optionally collects CLI 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 usage and error reporting information? (Y/n) [2022-05-27T11:25:42.298Z] FetchError: request to https://firebase-public.firebaseio.com/cli.json failed, reason: unable to get local issuer certificate
    at ClientRequest.<anonymous> (/usr/local/Cellar/firebase-cli/11.0.1/libexec/lib/node_modules/firebase-tools/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:390:28)
    at ClientRequest.emit (node:domain:475:12)
    at TLSSocket.socketErrorListener (node:_http_client:442:9)
    at TLSSocket.emit (node:events:390:28)
    at TLSSocket.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Error: Failed to make request to https://firebase-public.firebaseio.com/cli.json
~ ❯

ArcherN9 avatar May 27 '22 11:05 ArcherN9

A temporary fix export NODE_TLS_REJECT_UNAUTHORIZED=0 worked for me.

ArcherN9 avatar May 27 '22 11:05 ArcherN9

  1. I'm unable to support/test the firebase-cli brew package version since it being wrapped in whatever brew does isn't something we control - sorry.
  2. What version of node are you using?
  3. It's very likely that this has something to do with your local setup. From the same machine, do you have any issues curl-ing or opening https://firebase-public.firebaseio.com/cli.json in a browser?

bkendall avatar May 31 '22 19:05 bkendall

A temporary fix export NODE_TLS_REJECT_UNAUTHORIZED=0 worked for me.

Worked for me. Thanks @ArcherN9

10ndavis avatar Jun 08 '22 13:06 10ndavis

It's very likely that this has something to do with your local setup.

@bkendall Yes, it does appear so. My work laptop has all sorts of proxies/DNS restrictions in place. I recently formatted my system and did not install the proxies - It works as expected now.

What version of node are you using?

v18.2.0

do you have any issues curl-ing or opening https://firebase-public.firebaseio.com/cli.json in a browser?

Nope. That was the weird part - I was able to curl it, wget and open it on a browser. Just not when firebase cli executes it.

I concede there are things beyond what I understand about the whole Firebase CLI/brew system. But perhaps we could add this to the documentation somewhere?

ArcherN9 avatar Jun 09 '22 04:06 ArcherN9

Glad it's cleared up!

bkendall avatar Jun 09 '22 15:06 bkendall

A temporary fix export NODE_TLS_REJECT_UNAUTHORIZED=0 worked for me.

Thank you @ArcherN9 , I have another error related to the self signed certificate and this workaround helped me to run firebase login:ci successfully

firebase login:ci --debug
......
[2023-11-06T03:12:16.990Z] *** [apiv2] error from fetch(https://accounts.google.com/o/oauth2/token, {"headers":{},"method":"POST","body":{"_overheadLength":655,"_valueLength":214,"_valuesToMeasure":[],"writable":false,"readable":true,"dataSize":0,"maxDataSize":2097152,"pauseStreams":true,"_released":true,"_streams":[],"_currentStream":null,"_insideLoop":false,"_pendingNext":false,"_boundary":"--------------------------39405827254123229384288","_events":{},"_eventsCount":1}}): FetchError: request to https://accounts.google.com/o/oauth2/token failed, reason: self signed certificate in certificate chain
......

ctrongminh avatar Nov 06 '23 03:11 ctrongminh

  1. I'm unable to support/test the firebase-cli brew package version since it being wrapped in whatever brew does isn't something we control - sorry.
  2. What version of node are you using?
  3. It's very likely that this has something to do with your local setup. From the same machine, do you have any issues curl-ing or opening https://firebase-public.firebaseio.com/cli.json in a browser?

I have the same issue and when I open .json with curl this was the response {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"defaultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}

also this not worked for me export NODE_TLS_REJECT_UNAUTHORIZED=0

firebase version is 13.3.0 on mac os version 14.1

I don't know what should I do if it something related to my network or my device

abdullahalamodi avatar Feb 21 '24 15:02 abdullahalamodi

@abdullahalamodi i am also facing the same issue as you, have you found any solution for this? and this was the response when I open .json with curl "cloudBuildErrorAfter 1594252800000 cloudBuildWarnAfter 1590019200000 defaultNode10After 1594252800000 minVersion "3.0.5" node8DeploysDisabledAfter 1613390400000 node8RuntimeDisabledAfter 1615809600000 node8WarnAfter 1600128000000" same as you and also this "export NODE_TLS_REJECT_UNAUTHORIZED=0" command doesnt worked for me.

i have tried to deploy a firebase function but got some permission error and when i logged out from cli and thn tried to login again i got error.

Takrabal avatar Feb 18 '25 12:02 Takrabal

🚨 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