Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlutterFire cli - how to switch between separate firebase consoles

I have two separate firebase consoles accessed from two separate google accounts.

  • Firebase console "A" has three projects. Google account [email protected]
  • Firebase console "B" has one project. Google account [email protected]

Originally, I set up the Firebase "A" console using flutterfire cli flutterfire configure and it worked just fine, but setting up "B", it seems like there is some kind of caching for "A" issue.

In my completely separate google account for firebase console "B" I have created a project that I now need to run flutterfire configure for in the separate directory for project "B".

Using firebase login:add [email protected] and firebase login:add [email protected]. Both accounts have been authed, no problem. So I should be able to use firebase login:use to switch between the two, however flutterfire configure and firebase projects:list do not seem to respect which firebase account I'm signed into. They only show the projects for "A", never "B".

For example, switching to the directory for firebase project "B", I run firebase login:use [email protected] and then flutterfire configure [email protected]. flutterfire configure, incorrectly, the 3 projects from "A". Running firebase projects:list in directory "B" after running firebase login:use [email protected], only shows the projects from "A", not the 1 project I'm expecting to see from project "B".

In the directory for project "B", I tried running firebase init and it correctly listed my 1 project for "B" and I was able to init. But immediately after the init, running flutterfire configure or flutterfire configure [email protected], in the directory for "B", the following exception is returned, stating it can't find project "B" in the firebase account for "A". Notice that it states it "Found 3 Firebase projects", but project "B" only has 1 project, "A" has 3 projects.

i Found 3 Firebase projects. Selecting project B.
FirebaseProjectNotFoundException: Firebase project id "B" could not be found on this Firebase account.

And I am signed into to "B", not "A". Some kind of cache issue? How do I break the cache?

I have completely removed npm -g firebase-tools and flutterfire from dart global. I've deleted all .firebaserc and firebase.json files I could find. None of it worked.

ANSWER (for my use case):

If you're having issues switching accounts firebase projects:list --debug may very well give you the insight for more difficult issues like mine here.

Using firebase projects:list --debug I saw that the authorization was using an ENV FIREBASE_TOKEN, which at some point I must have put into my ~/.bashrc. This token was for project "A". I removed the ENV token and now everything is working as expected.

like image 784
Zelf Avatar asked Jan 31 '26 23:01

Zelf


2 Answers

I had the same scenario. What worked for me was the following:

Add the A account in the possible accounts to use.

firebase login:add [email protected]

Configure project selection with correct account.

flutterfire configure --account [email protected]
like image 173
egonzal Avatar answered Feb 02 '26 15:02

egonzal


Step 1: See all available accounts

 firebase login:list  

Step 2: Add more accounts:

firebase login:add [email protected]

Step 3: Switch to another email

firebase login:list  (to see if email was successfully added)
firebase login:use [email protected] (to switch email)

Step 4 :

flutterfire configure --account [email protected]
like image 31
Gizmo1337 Avatar answered Feb 02 '26 13:02

Gizmo1337



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!