Apologies if this was already raised. It would be nice for firebase login to not have to be client account wide (i.e. ~/.config/configstore/firebase-tools.json). I use an OSX machine, and deploy to multiple firebase accounts. Switching users on OSX is a PITA (and disrupts communication apps). Logging in and out of firebase is also not ideal. Ideally, the config would be stored in the project root (and I'd just .gitignore it).
Let me know where to look at a high level and I'll submit a PR. Or perhaps this already exists and I'm just using it wrong.
hey I need this too so I'm going to work on a fix for it and push a PR.
stay tuned and once it's out let me know if it works well for you too
A workaround is to only require a single firebase login by choosing a google account to login with locally, and then use IAM to add access to all the various firebase projects that you need access to.
Any chance that this will be looked at again? Apparently there's also a linked PR that would make our life easier
As Firebase is getting into more and more companies, I know a lot of devs having this issue with firebase login: one account linked to their personal google account and another linked to their work google account. Having to logout/login is not critical, but not awesome either 馃槃
Please make this a feature, I am running 4 accounts and 20 different projects amongst them, its a real hustle when I update my master and have to merge it into all projects and then deploy all separately with individual accounts.
Yes please! This would be a huge help!
Even though this might be a lot of work: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html
for the amazon cli it is possible to pass a --profile NAME param for every cli call
Any update on this feature? Was looking forward for this feature and can't wait to see how much easier my life will goes with this feature 馃崱
any update on this?
Thanks for all the comments here. We're aware of this as a feature request, but we lack in time to really look into this.
If someone was interested in making this into a PR of some kind, requireAuth is a likely place to start. That's the place where authorization tends to happen (and the usage can be tracked around the CLI).
There likely will be internal review because this would add new commands/flags to the CLI, but I think this may be reasonable to accomplish
@bkendall Still lacking time? I imagine there is a way to quickly switch configs behind-the-scenes, but I don't know enough of the internals of firebase tools to do that. For now, I have to re-auth* when context switching. It is an annoying overhead, particularly for locally-hosted CI/CD. Meaning, if I'm not watching it, I don't know that it wasn't that my build failed but that the deploy couldn't push.
So I found a work-around on Linux (Ubuntu).
When you login (but before you log out), your auth tokens are stored in ~/.config/configstore/firebase-tools.json.
For each company:
firebase-tools-[companyName].jsonThen I added the following aliases to my profile:
alias context.firebase.company1="cp ~/.config/configstore/firebase-tools-company1.json ~/.config/configstore/firebase-tools.json"
alias context.firebase.company2="cp ~/.config/configstore/firebase-tools-company2.json ~/.config/configstore/firebase-tools.json"
Not as elegant as I was hoping, but easier than learning the internals of the tool, proposing a PR, etc. Enjoy!
Tip: If you need to know which account you are currently using, just run firebase login. If your auth is valid, it'll spit out the email address.
My case is much simple: I ocassionaly run distribution script for another account. Managed to do it without logging out from my main account:
firebase login:ci
# gives a token for the specified account.
Then I use that token to run a command from another account, like so:
firebase appdistribution:distribute AppFromAnotherAccount.ipa \
--token "1//03To-kEntokEnt-Oken..."
When the command is finished I remain under my main account
Update: you can set this token to FIREBASE_TOKEN env variable.
I didn't test it but seems like you'll be able switch accounts by switching values of that variable.
@oluckyman I suppose that would work, but I think that functionality was mainly for use by servers/bots. Also, do you have to log in to the other account each time? I think the main reason this was opened was because some people get tired of logging in over and over again.
For example, I use a different browser for each client. Each password is unique and strong (very long). I definitely do not memorize them. I have to use the browser to authenticate or a password tool to retrieve the password.
Therefore I cannot create cron jobs that automatically deploy/update code. I have to be present.
@bean5 You have to login to get the token once. Then you provide token to any command and it runs as if you logged in to another account. No need to relogin.
Hi all, I created a small cli helper that leverages login:ci to allow using multiple accounts on one machine. If you want, you're welcome to use it, and I'd love for some feedback and ideas :)
It's called firebase-multi and it's pretty easy to use:
yarn add -g firebase-multi or npm i -g firebase-multifirebase login:ci and complete login flow until you get the firebase ci token in your terminal.firebase-multi set <your-project> <firebase-ci-token>firebase-multi use <your-project> firebase deploy (or any other firebase command that requires authentication)All tokens are saved in ~/.config/configstore/firebase-multi.json
Most helpful comment
Hi all, I created a small cli helper that leverages login:ci to allow using multiple accounts on one machine. If you want, you're welcome to use it, and I'd love for some feedback and ideas :)
It's called firebase-multi and it's pretty easy to use:
yarn add -g firebase-multiornpm i -g firebase-multifirebase login:ciand complete login flow until you get the firebase ci token in your terminal.firebase-multi set <your-project> <firebase-ci-token>firebase-multi use <your-project> firebase deploy(or any other firebase command that requires authentication)All tokens are saved in ~/.config/configstore/firebase-multi.json