I have logged in into firebase.com using my google account.
Now in command prompt I am doing
>firebase init
and it keeps on asking me about email and password.
Since I logged into via google , I am not sure what is password for firebase account. I have enabled email and password authentication in my app and added users also but still not able to successfully login via firebase init command.
Any suggestions?
You're likely using a version of the Firebase command line tools that don't support Google authentication yet. To upgrade, run:
npm update -g firebase-tools
After that running firebase login will pop up a browser window where you complete the Google sign-in.
There is now an interactive flag that you can add that opens the browser and you can log in using your google account/credentials that way:
firebase login --interactive
Related
I have recently started learning about building a serverless backend using Firebase for the cloud functions. I have been able to set up a Firebase project with some functions, which I would like to deploy. However, since I have previously logged in with another service account, it does not allow me to deploy despite the fact that I logout first and then login with the proper account.
I logout with firebase logout, which states Logged out from ....#gmail.com. Then I login with the proper account with firebase login, which opens my browser so that I can login with my account.
When I try to deploy with firebase deploy it throws an error
Missing permissions required for functions deploy. You must have permission iam.serviceAccounts.ActAs on service account previousAccount#appspot.gserviceaccount.com.
To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL:
https://console.cloud.google.com/iam-admin/iam?project=previousAccount
I have also tried setting the proper account as the default one for the project directory, but that did not address the issue.
How can I erase the other service account and start using the proper one?
I am trying to login to the Firebase Tools CLI with a GCP service account. I have the path to the service account credentials saved as GOOGLE_APPLICATION_CREDENTIALS. I have logged out of firebase with firebase logout and have tried to sign in with the service account with firebase login --no-localhost and firebase login --no-localhost --token $GOOGLE_APPLICATION_CREDENTIALS. However in bother cases a web browser opens asking me to log in with my user account. How can I log in to firebase with a service account?
Taken from Michael Bleighs comment:
"The Firebase CLI does support GOOGLE_APPLICATION_CREDENTIALS, but you don't need to "log in" with them. If the environment variable is pointing to a valid service account you should be able to just use CLI commands as if you are logged in. You do need to be logged out for GAC to work correctly. Run the command with --debug if you're getting errors while trying to do so."
I can confirm I have this working. Note you might need to run firebase use <project-id> for it to work correctly.
You can't sign in to your Firebase project with a service account. You will need to use the proper user account of a collaborator on the project to sign in with Firebase tools.
Even when using the CI integration, the documentation says to:
Start the signin process by running the following command:
firebase login:ci
Visit the URL provided, then sign in using a Google account.
So I'm minding my own business trying to initializing a Firebase project in my Angular app when all of the sudden I'm hit with this error:
Error: Failed to list Firebase projects. See firebase-debug.log for more info.
To get to that point, I followed the instructions in the documentation here which are basically run:
$ npm install -g firebase-tools
$ firebase login // Turns out I was already logged in
$ firebase projects:list // Make sure you can access your account.
Anyway, back to the error. "Ok," I think. "I'll just check out the log it's pointing me to." I open the log and see:
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.`
`FirebaseError: 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 part about "invalid authentication credentials" makes me think it has something to do with me not being logged into firebase but firebase login shows I am logged in.
The URL in the log just takes me to the docs for using firebase auth in my app. Well, I would love to. But first I need this command to work, Firebase.
Has anyone run into this/have a solution for it?
Update
The fix is:
$ firebase login --reauth
Thanks to #kynan in the comments for simplifying the original two-liner down to this one-liner.
If that doesn't work, you can also try logging out and logging back in like the original answer.
Original Answer
The fix is:
$ firebase logout
$ firebase login
It looks like when you upgrade firebase-tools, that may invalidate your auth token. You just have to log out and log back in.
Here's the message when you log out:
$ firebase logout
! Invalid refresh token, did not need to deauthorize
+ Logged out from <email>
For people who don't want to logout, the below command will also work.
firebase login --reauth
use firebase logout to log out
then use firebase login to log back in to firebase in the CLI
Do this after updating the firebase tools using npm install -g firebase-tools
After succesfull login, use firebase use --add to list all the projects you have
for Who don't want to logout, the below command also work
firebase login --reauth
First go to command prompt and run below code then execute above code.
In Command Prompt:
Run : powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
In my case that it couldn't list my firebase projects, I try to access firebase by vpn that I was installed on my system (not my browser), and it worked. Then I could initial firebase in my project as hosting and deploy it.
Okay so for me it was the problem of the wifi I was using. Apparently the wifi had been denied access to firebase so I used vpn and it worked like charm. You can try using a vpn to see if it would come
I encountered Exact same error but for a different reason. I was configuring Flutter app for Both iOS and Android. My bundleId contained a _ in it. so when I tried
flutterfire configure
Then my android app would configure just fine but iOS would not. and give this error. So if the above solution isn't working for you like me please check your bundleId or package Name. it can be the culprit.
I am trying to configure my google storage for Firebase to allow cross origin uploading using gsutil and a cors.jsonfile. I enter the following command in my project where the cors file is located:
gsutil cors set cors.json gs://nameofproject.appspot.com
I get the following error message:
AccessDeniedException: 403 someOtherFirebaseAccount#gmail.com does not have storage.buckets.get access to bucket apptotest.appspot.com
I am not currently logged in with someOtherFirebaseAccount -- I verify this by running firebase login and seeing that my current, desired account is the active one.
firebase login
Already logged in as desiredAccount#gmail.com
Any ideas what could be going wrong here?
If you're using the version of gsutil that comes packaged with gcloud, it will use credentials for your currently logged in gcloud user (this is usually the last user you activated via gcloud auth login). You can check which user is active by running gcloud auth list.
If you're not using the gcloud-packaged version of gsutil, you can run gsutil config and log in as the desired user.
Can someone help me to solve this error I cannot run firebase init command before running firebase deploy.
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
if you are behind proxy invoke set "NODE_TLS_REJECT_UNAUTHORIZED=0"
as described here
Your credentials are not valid
All you need is to login again
Try the command firebase login --reauth
For such Authentication Error from Firebase CLI.
Do the below steps:
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
Even after this repeatedly getting Firebase login CLI issue - suggest restart your system and do firebase login again
Hope this helps!
Please try this command
set "NODE_TLS_REJECT_UNAUTHORIZED=0"
and then re-run,
firebase login