11

I've just installed the firebase-tools with the as usual npm package installation process :

npm install -g firebase-tools 

i've already created a Firebase account connect with Google Account, but the problem is that the only procedure i can made with the command line tool is :

firebase login          // with success 
firebase prefs:token    // return me the auth token 

but every time i try the other commands i get the error :

Error: Authentication required. 

for example for the command init, list etc :

firebase init         // error 
firebase list         // error 

and so on ... why ?

The version of npm, node and firebase-tools :

node : v4.2.2
npm : 3.3.12
firebase : 2.2.0
cicciosgamino
  • 871
  • 3
  • 10
  • 29
  • 3
    I had some similar issues yesterday. Can you try `firebase logout` and then `firebase login` again? – Frank van Puffelen Jan 04 '16 at 15:18
  • I've already tried more than once ! I can get what can be the problem .... if can help i use -> Linux 3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux – cicciosgamino Jan 04 '16 at 16:21
  • just tried, neither with the version firebase-tools 2.1.1 seems to work, always the same error : – cicciosgamino Jan 04 '16 at 16:55
  • After some uninstall/install i can use the firebase-tools only prompted the token for each command : firebase list --token 'gsdgdsdg ....... ' ! So what can be the problem in my environment ? – cicciosgamino Jan 05 '16 at 23:24
  • See also https://github.com/firebase/firebase-tools/issues/160 – Colonel Panic Sep 18 '16 at 12:54

7 Answers7

3

Use following command

1) firebase use --add

-> select project .firebaserc file has been created in your source dir

2) firebase deploy

now deploying hosting.

Thanks

Ravi
  • 2,360
  • 1
  • 15
  • 11
3

I followed these steps, and its working perfectly fine. Then only problem is you will have to have a token saved somewhere in your file so that you can use every time when you run a command firebase serve, deploy

Step 1 - firebase login:ci --no-localhost after logging in you will get a token from google. paste it on your cmd where it is asking for : Paste authorization code here: hit enter. when you will hit enter you will get the authentication token from google. copy it and go to the step 2

step 2 - firebase server --token "PASTE_YOUR_TOKEN_HERE"

Sufiyan Ansari
  • 1,780
  • 20
  • 22
2

Solved : On the machine was set a FIREBASE_TOKEN environment variable expired when i've connected the firebase account with the google account!

Due to the order of precedence for token loading is flag, environment variable, config file, so every time i didn't use the flag --token i got the error! I update the FIREBASE_TOKEN env variable and with a system restart the problem solved !

cicciosgamino
  • 871
  • 3
  • 10
  • 29
1

I tried the login and logout, with even restarting without any luck. I also upgraded the firebase account to the new 'console.firebase.google.com' which is when I had my problem. I ended up using

npm install -g firebase-tools

to upgrade the tools to the current version. After that there was a little configuration to do, but I eventually was able to deploy the static site files again.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Dan
  • 45
  • 5
  • Same here. With version 3.13 it just wouldn't work but with the current version (3.16) there were no more auth-related problems – Motin Dec 10 '17 at 18:38
  • please add some details, what a little configuration you had to do. even if it is one line of code. – Janatbek Orozaly Oct 31 '20 at 20:29
1

Steps to check error and to rectify the error Note: Here test is the project name

C:\Users\DELL>d:

D:>cd reactapp

D:\reactapp>cd test

D:\reactapp\test>firebase init

Error: Failed to authenticate, have you run firebase login?

D:\reactapp\test>npm install -g firebase-tools

D:\reactapp\test>firebase init

Error: Failed to authenticate, have you run firebase login?

Solution

D:\reactapp\test>firebase login --reauth

Connect your firebase Email Again to Firebase popped up link

Visit this URL on this device to log in: https://accounts.google.com/o/oauth2/auth?client_id=.................. so on (firebase link)

Waiting for authentication...

  • Success! Logged in as ###########@gmail.com

D:\reactapp\test>firebase init

 ######## #### ########  ######## ########     ###     ######  ########
 ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
 ######    ##  ########  ######   ########  #########  ######  ######
 ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
 ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

D:\reactapp\test

? Are you ready to proceed? (Y/n)

0

Try downgrading npm install -g firebase-tools@2. firebase-tools@3 is incompatible with "legacy console" apps at https://www.firebase.com/account/

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
0

use this: firebase login:ci

instead of firebase login

Qahsi
  • 1
  • 1