question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple "firebase login" per client account

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:57
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
atlantehcommented, May 16, 2020

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:

  1. Install this module globally by running yarn add -g firebase-multi or npm i -g firebase-multi
  2. Run firebase login:ci and complete login flow until you get the firebase ci token in your terminal.
  3. Run firebase-multi set <your-project> <firebase-ci-token>
  4. Run in terminal/package.json script: 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

9reactions
bean5commented, Feb 13, 2020

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:

  • rename that file to be firebase-tools-[companyName].json
  • log into next company and repeat. If you copy the previous file instead of moving it, you’ll probably end up logging out, which will invalidate what you copied. So DOT NOT do that.

Then 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Link Multiple Auth Providers to an Account Using JavaScript
You can allow users to sign in to your app using multiple authentication providers by linking auth provider credentials to an existing user...
Read more >
Firebase Multiple Accounts are signed at the same time
You'll be able to sign in with two users in this way if there are two projects to sign in with. You'll have...
Read more >
One Firebase, multiple company clients - Google Groups
Each 'client' is actually a unique company, unrelated to other clients (companies), and do not share data nor users. Authentication cannot rely on...
Read more >
Allow multiple accounts with the same email address
firebase.auth().linkWithRedirect(). When you allow only one account per email address, these functions retrieve user profile information from the identity ...
Read more >
Linking multiple providers to an account | Identity Platform ...
Create multiple accounts for each identity provider: A new Identity Platform user account ... Sign in the user with any authentication provider or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found