firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 925 forks source link

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

Open JuliusKumar opened 4 years ago

JuliusKumar commented 4 years ago

[REQUIRED] Environment info

firebase --version = 8.6.0

firebase-tools:

Platform: Windows 10

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Listed below are the commands and responses firebase login Already logged in as juliuskumar firebase projects:list × Preparing the list of your Firebase projects Error: Failed to list Firebase projects. See firebase-debug.log for more info.

[REQUIRED] Expected behavior

firebase projects:list - should connect to firebase account and list my projects

[REQUIRED] Actual behavior

Listed below are the commands and responses

firebase projects:list × Preparing the list of your Firebase projects Error: Failed to list Firebase projects. See firebase-debug.log for more info.

<---DEBUG LOG -->
[debug] [2020-07-31T15:33:32.772Z] ----------------------------------------------------------------------
[debug] [2020-07-31T15:33:32.775Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\< >\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js projects:list
[debug] [2020-07-31T15:33:32.775Z] CLI Version:   8.6.0
[debug] [2020-07-31T15:33:32.775Z] Platform:      win32
[debug] [2020-07-31T15:33:32.775Z] Node Version:  v10.15.3
[debug] [2020-07-31T15:33:32.778Z] Time:          Fri Jul 31 2020 08:33:32 GMT-0700 (Pacific Daylight Time)
[debug] [2020-07-31T15:33:32.778Z] ----------------------------------------------------------------------
[debug] [2020-07-31T15:33:32.778Z] 
[debug] [2020-07-31T15:33:32.791Z] > 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] [2020-07-31T15:33:32.792Z] > authorizing via FIREBASE_TOKEN environment variable
[debug] [2020-07-31T15:33:32.802Z] > refreshing access token with scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-07-31T15:33:32.803Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-07-31T15:33:32.944Z] 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] [2020-07-31T15:33:32.949Z] FirebaseError: 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
    at Object.<anonymous> (C:\Users\< >\AppData\Roaming\npm\node_modules\firebase-tools\lib\auth.js:23:32)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\< >\AppData\Roaming\npm\node_modules\firebase-tools\lib\commands\login.js:20:14)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
[error] 
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.
google-oss-bot commented 4 years 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.

JuliusKumar commented 4 years ago

I've logged in multiple times but looks like the CLI is unable to connect to the firebase console to retrieve details

samtstern commented 4 years ago

@JuliusKumar when filing issues please fill out the issue template otherwise we won't be able to debug. For instance we really need to see what the error in the debug logs is here.

If you're having trouble connecting it may be due to a Firewall or VPN that you are using on your machine?

JuliusKumar commented 4 years ago

I have updated the issue with the debug log

samtstern commented 4 years ago

@JuliusKumar this line means that somewhere you have the FIREBASE_TOKEN environment variable set:

> authorizing via FIREBASE_TOKEN environment variable

So that overrides the credential from firebase login. You should find out where you have that variable set and undo it,

JuliusKumar commented 4 years ago

Hi Sam, I've checked and removed FIREBASE_TOKEN variable and I still get error. I also tried reauthorizing it confirms that I am logged in. But the debug log says that "Authorization Error"

<------
C:\Users\kumarja\workspace\GCP\firebase\functions>set FIREBASE_TOKEN
Environment variable FIREBASE_TOKEN not defined

C:\Users\kumarja\workspace\GCP\firebase\functions>firebase login
Already logged in as juliuskumar.email@gmail.com

C:\Users\kumarja\workspace\GCP\firebase\functions>firebase projects:list
× Preparing the list of your Firebase projects

Error: Failed to list Firebase projects. See firebase-debug.log for more info.
----------->

<--------DEBUG LOG ------------------------>
[debug] [2020-08-03T15:24:59.618Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\kumarja\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js projects:list
[debug] [2020-08-03T15:24:59.619Z] CLI Version:   8.6.0
[debug] [2020-08-03T15:24:59.620Z] Platform:      win32
[debug] [2020-08-03T15:24:59.620Z] Node Version:  v10.15.3
[debug] [2020-08-03T15:24:59.623Z] Time:          Mon Aug 03 2020 08:24:59 GMT-0700 (Pacific Daylight Time)
[debug] [2020-08-03T15:24:59.623Z] ----------------------------------------------------------------------
[debug] [2020-08-03T15:24:59.624Z] 
[debug] [2020-08-03T15:24:59.649Z] > 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] [2020-08-03T15:24:59.650Z] > authorizing via signed-in user
[debug] [2020-08-03T15:24:59.664Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-08-03T15:24:59.665Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-08-03T15:24:59.824Z] Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth
<---------------------------------------------------------->
samtstern commented 4 years ago

@JuliusKumar thanks for the extra logs. Have you tried running firebase logout and then running firebase login again?

google-oss-bot commented 4 years ago

Hey @JuliusKumar. 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!

JuliusKumar commented 4 years ago

I've tried to logout and re-login many times. it does not work. Keeps giving me credentials error. Something seems to be missing in the oauth set up.

[debug] [2020-08-13T01:42:23.263Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"] [debug] [2020-08-13T01:42:23.263Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
[debug] [2020-08-13T01:42:23.397Z] Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

JuliusKumar commented 4 years ago

Additionally, I noticed that if I don't work on the firebase CLI commands for 1 day, the next day having to re-login, I can run the command "firebase projects:list" and it lists my projects. It works a few times and starts throwing error as before.

One of the error messages I've seen is - "Error: Server Error. self signed certificate in certificate chain"

samtstern commented 3 years ago

@JuliusKumar sorry for the very late response but I think I may know what's going on here. Is it possible you or someone you work with is using Google Cloud session duration controls: https://support.google.com/a/answer/9368756?hl=en

Basically these are controls that mean your firebase login credentials would expire on some regular interval, but the Firebase CLI wouldn't be aware of this.

codeVirtuoso21 commented 3 years ago

Hello, such a thing is happening to me now. image I wanna help someone with this.

aboutmydreams commented 2 years ago

is there anything way to solve this problem?

godrien commented 2 years ago

from stackoverflow answer https://stackoverflow.com/questions/44471670/firebase-init-command-failing-to-execute/62071359

  1. firebase logout
  2. firebase login
  3. Once the URL opens, go to Google account and remove access which was already given to firebase app distribution ["Remove Access"]
  4. Come back to the URL window and select Allow
  5. Should result in a successful login
micksatana commented 1 month ago

Happen to me today on the firebase-tools v13.13.3. When I tried to run firebase logout first, the error still the same, as it always telling to login with --reauth. So when this issue happen in my case login, logout, and projects:list commands are not working.

The workaround is to use gcloud auth login first, then the firebase logout will be usable again, then I can run firebase login successfully. Hope this helps.