Zero_Bolt
Zero_Bolt

Reputation: 119

how to change firebase account in a flutter project?

I created a flutter project with my personal firebase, but now the client has already created his firebase, how do I change the account in a project, I've searched the documentation but without success?

Upvotes: 1

Views: 3390

Answers (4)

aimme
aimme

Reputation: 6773

Recently I had to change the firebase project of an app to a project created in some other account. This method will work even if the new project belongs to same user too.

Note: Path to firebase.exe should be added to Environment Variables PATH and flutterfire should be able to call it within the project. Or fibase.exe could be placed in the project root(but do not commit to git). If using the later you can call .\firebase.exe login --reauth. If added to path run the following command reauthenticate with the user to which the new project belongs to.

firebase login --reauth

Re configure flutterfire

flutterfire config

Following question will be asked. Select 'no'

You have an existing firebase.json file and possibly already configured your project for Firebase. Would you prefer to reuse the values in your existing firebase.json file to configure your project?

no

Next Question. For this question select 'yes':

? Generated FirebaseOptions file ...\firebase_options.dart already exists, do you want to override it? (y/n)

yes

It will load the projects of the logged in user. Select the project you want to link or create a new project and link it.

Upvotes: 0

Manish Gond
Manish Gond

Reputation: 56

Its very simple, just type this

firebase login --reauth

Upvotes: 4

Dabbel
Dabbel

Reputation: 2825

// Change Firebase project.
// May require `firebase login` to access the project.

firebase use MYPROJECT

// Update Flutter configuration based on project. 
// --yes will overwrite the configuration.

flutterfire config \
  --project=MYPROJECT \
  --out=lib/firebase_options_dev.dart \
  --android-package-nam=com.myandroid.id \
  --platforms=web,android --yes

// In case of using glocud, switch the project, too.
// May require `gcloud login` to access the project.

gcloud config set project MYPROJECT

Note

Some parameters of FlutterFire are optional, Flutterfire will try figuring out the correct values. Check all parameters with flutterfire --help config.

Upvotes: 1

Pawandeep Singh
Pawandeep Singh

Reputation: 397

Unfortunately there is no easy way to switch.

The information you configured when you first created flutter project on firebase, it has be configured again with clients Firebase.

For example -> replace old GoogleService-info.plist, android package name and iOS bundleID with the new one.

Upvotes: 1

Related Questions