To set up Firebase the first thing to do is to have an account.
Register at https://firebase.google.com/ and start creating a new project, it's very easy, just click on the big button that says "Add project".
I have named it FlutterStarterKit but you can name it whatever you want your application to have. It is simple.
Once inside, we must add the platforms we are going to use with their unique package identifier. In this case, we have done it with Android.
Adding Android as a platform to Firebase generates a json file that you must add to the directory: android/app of your application as shown in the image below.
Please note that I deliver the StarterKit with a package name that I have given it. You will have to change it in the following places:
Change the applicationId in android/app/build.gradle
defaultConfig {
applicationId "com.flutter.starterkit"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
Change the bundle identifier from your Info.plist
file inside your ios/Runner
directory.
<key>CFBundleIdentifier</key>
<string>com.flutter.starterkit</string>
The next point is to enable user authentication, it is very simple. In the left sidebar we look for the option "Build" and inside "Authentication".
Once inside we must activate the following options:
Activate both methods with the default options.
If we would like to add new authentication methods there is no problem but keep in mind that this starter kit currently only has these two.
The next step is to add the security signatures to Firebase to allow us to test. For this we must use the terminal of Visual Studio or Android Studio.
Use the following commands to generate SHA1 and SHA-256 signatures
cd android
./gradlew signingReport
El resultado de este comando será algo como:
Task :app:signingReport
Variant: debug
Config: debug
Store: C:\Users\Valen\.android\debug.keystore
Alias: AndroidDebugKey
MD5: ED:3C:4C:A3:2E:42:85:A8:33:D8:32:FB:34:F5:A8:CA
SHA1: EE:AC:F0:B0:29:52:BE:CA:2C:D3:95:0F:5C:8E:11:C3:60:7A:45:35
SHA-256: 70:C8:13:F1:85:A2:6F:8C:D8:6D:60:E0:1C:3B:10:13:0E:A3:DD:43:4B:E9:75:62:28:6C:DB:CA:F1:C8:DF:A8
Valid until: domingo, 2 de febrero de 2053
----------
Now we must go to the configuration of our application in Firebase and add them as fingerprints
For now, this is all the configuration we need to do in Firebase to start testing our application.