firebase-tools:
6.3.1
Platform:
Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-141-generic x86_64)
Unable to init functions and deploy any functions while having my account logged in. Here are some logs:
λ ~/code/android/CoreWriter/ master* firebase login
Already logged in as [email protected]
λ ~/code/android/CoreWriter/ master* firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/home/core/code/android/CoreWriter
Before we get started, keep in mind:
* You are initializing in an existing Firebase project directory
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices. Firestore: Deploy rules and create indexes for Firestore
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
i .firebaserc already has a default project, skipping
=== Firestore Setup
Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
λ ~/code/android/CoreWriter/ master* firebase deploy --only functions
Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
Having trouble? Try firebase deploy --help
λ ~/code/android/CoreWriter/ master* firebase list
Error: HTTP Error: 401, The entered credentials were incorrect.
As you can see in the log, init, deploy and list command could not be executed and return me a Error 401.
I've tried log out and log in, re-install firebase-tools, and reboot, but none of them worked.
Functions are expected to be deployed online.
Got a Error 401 like this:
Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
The network I can use was protected ( or limited? ) by the GFW ( you may know what is that ), and firebase-tools could not work under network proxy, so I bought a VPS server which located in Los Angeles to deal with this.
As a result, I have to use firebase login --no-localhost to log in, does this matter?
No, so long as things are working now there should be no problem
On Fri, Feb 1, 2019, 3:19 AM DrkCore notifications@github.com wrote:
The network I can use was protected ( or limited? ) by the GFW ( you may
know what is that ), and firebase-tools could not work under network proxy,
so I bought a VPS server which located in Los Angeles to deal with this.As a result, I have to use firebase login --no-localhost to log in, does
this matter?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/1131#issuecomment-459690761,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_nTBCd5NiS0cbYThQhjv2PZjCX7sks5vJCKzgaJpZM4aeA8x
.
No, so long as things are working now there should be no problem
…
On Fri, Feb 1, 2019, 3:19 AM DrkCore @.*> wrote: The network I can use was protected ( or limited? ) by the GFW ( you may know what is that ), and firebase-tools could not work under network proxy, so I bought a VPS server which located in Los Angeles to deal with this. As a result, I have to use firebase login --no-localhost to log in, does this matter? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#1131 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAD_nTBCd5NiS0cbYThQhjv2PZjCX7sks5vJCKzgaJpZM4aeA8x .
Yeah..., but the problem still exists.
Is there any solution or advisement for this situation?
OK, it was fixed somehow when I upgraded my Ubuntu 16.04 to 18.04. That's kind of weird, but at least it worked. Hope this may help someone who has came across with same problem with me.
For posterity, I got this error when I had an old FIREBASE_TOKEN env variable set. Seems like firebase prefers that to the normal login which is a bit counter-intuitive.
@judas-christ you actually just rescued me 👍
In my case, I restored a system image from backup and the old FIREBASE_TOKEN that was copied over made the Firebase CLI believe that I was already logged in, thus I was getting "Error: HTTP Error: 401". Using firebase logout then firebase login, you can force the FIREBASE_TOKEN to be refreshed and the error will go away. Hope that helps!
@erikhaddad thank you, it saves me a lot of time.
for server (linux)
# 1. login
sudo firebase login:ci --no-localhost --debug
# 2. copy auth link to your browser, and go step by step
# 3. copy authed string to console
# 4. get firebase token
# 5. init project
sudo firebase init --token firebase token
firebase logout then firebase login it solves my problem
Most helpful comment
In my case, I restored a system image from backup and the old
FIREBASE_TOKENthat was copied over made the Firebase CLI believe that I was already logged in, thus I was getting "Error: HTTP Error: 401". Usingfirebase logoutthenfirebase login, you can force theFIREBASE_TOKENto be refreshed and the error will go away. Hope that helps!