Connect the Firebase authentication emulator from your Flutter app
—
Flutter
Firebase relased the Authentication emulator recently.
Firebase project
You can use it in your existing Flutter app by adding, in firebase.json
:
"auth": {
"port": "9099",
"host":" "0.0.0.0"
}
to the "emulators"
object in your Firebase project. You can change port and host according to your needs.
Then you can run
firebase emulators:start --only functions,firestore,auth
replacing the list of emulators with your own list.
Flutter project
The FireFlutter plugin still does not allow to set the emulator for Firebase Authentication. You can set it up manually for iOS and Android.
For instance, for iOS, you can open ios/Tunner/AppDelegate.swift
and add this line to the didFinishLaunchingWithOptions
method:
Auth.auth().useEmulator(withHost: '0.0.0.0', post: 9099)
Also, remember to import Firebase in AppDelegate.swift
:
import Firebase
Leave a comment