Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Firebase user login identity from command line (CLI)?

I'm trying to login to Firebase using login credentials of, let's say, User-Alice.

But when I go through the authorization procedure I get a message saying I'm logged in as User-Bob. This is not mentioned anywhere in the documentation nor does it explain how to change the user I'm logged in as.

How can I change the Firebase logged in user from User-Bob to User-Alice?

Thank you.

like image 246
Let Me Tink About It Avatar asked Nov 25 '15 12:11

Let Me Tink About It


People also ask

How do I connect to Firebase command line?

To download and run the binary for the Firebase CLI, follow these steps: Download the Firebase CLI binary for Windows. Access the binary to open a shell where you can run the firebase command. Continue to log in and test the CLI.

What is Firebase CLI?

The Firebase CLI is a utility used to administer Firebase projects and perform tasks such as Realtime Database management tasks from the command-line of a terminal or command-prompt window. The Firebase CLI is also the method by which Firebase Cloud Functions are deployed and managed.

How do I reset my Firebase authentication password?

To send a password reset email to user, on the Users page, hover over the user and click ... > Reset password. The user will receive an email with instructions on how to reset their password. You can customize the email from the Email Templates page.


3 Answers

Manage multiple users via the CLI

You can manage multiple users without re-authenticating, as of version 9.9.0 of the Firebase CLI.

firebase login:add
firebase login:list
firebase login:use

Example:

firebase login:add [email protected]
firebase login:add [email protected]
firebase login:add [email protected]
firebase login:use [email protected]
firebase login:list
firebase deploy --only hosting # deploy as [email protected]

Get a URL printed to the terminal.

firebase login --reauth

Use that link in the browser with the needed profile.


Still working, less convenient older answer

The easiest way to handle this is to logout User-Alice and the login User-Bob.

firebase logout
firebase login

But, if you're logged as User-Alice with a Google account in the browser you'll need to sign out there first.

like image 77
David East Avatar answered Oct 19 '22 15:10

David East


use this

firebase login --reauth

then you can change account

like image 37
john lee Avatar answered Oct 19 '22 13:10

john lee


In the recent release of Firebase CLI (9.9.0) there was support for multiple accounts via new commands:

  • login:use
  • login:add
  • login:list

Reference: https://github.com/firebase/firebase-tools/tree/v9.9.0

So I used firebase login:add to add a new account and then switched to newly added account use firebase login:use

like image 14
Brahmdev Avatar answered Oct 19 '22 15:10

Brahmdev