Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Firebase projects | logins

I have multiple customer projects with project directories in VScode that I switch between. These all use Firebase and have different Firebase (i.e. Google accounts).

Every time I switch I have to

  1. firebase logout
  2. Switch to the active Chrome window of the Google/Firebase account I wish to connect to
  3. firebase login, which will launch auth in this Chrome instance.

Sometimes its easy to forget - is there an easy way to link a Google/Firebase accounts to a project directory so when you open that directory you are connected to that Firebase instance (without having multiple laptop profiles)? With git with can specify settings in the directory config file.

Just interested to know?

like image 474
Lee Avatar asked Jun 01 '26 09:06

Lee


1 Answers

I don't know if you are still looking for the solution. But now it is available with firebase CLI.

login:add   Authorize the CLI for an additional account.
login:list  List authorized CLI accounts.
login:use   Set the default account to use for this project

Reference https://firebaseopensource.com/projects/firebase/firebase-tools/

Multiple Accounts

By default firebase login sets a single global account for use on all projects. If you have multiple Google accounts which you use for Firebase projects you can authorize multiple accounts and use them on a per-project or per-command basis.

To authorize an additonal account for use with the CLI, run

firebase login:add

You can view the list of authorized accounts with

firebase login:list

To set the default account for a specific Firebase project directory, run

firebase login:use

from within the directory and select the desired account. To check the default account for a directory, run

firebase login:list

and the default account for the current context will be listed first.

To set the account for a specific command invocation, use the

--account

flag with any command. For example

firebase [email protected] deploy

The specified account must have already been added to the Firebase CLI using

firebase login:add
like image 190
Gimhana Jayasekara Avatar answered Jun 04 '26 12:06

Gimhana Jayasekara



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!