# Firebase Intergation

### Set up Firebase project <a href="#set-up-firebase-project" id="set-up-firebase-project"></a>

To start using Firebase with the application, you first have to create a new Firebase project. Follow the steps below:

* Create a new Firebase project by going to the [Firebase console](https://console.firebase.google.com/)
* Click on **Add project**.

![](https://364087463-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaeJXH0pTNZFPNJMUbR%2F-Maewp_jbVfs5_wTk7AG%2F-Maewyi0MIl1RDFXZi_G%2Ffirebase_1.png?alt=media\&token=760aaab9-fde8-469f-a8ea-09c686704fa1)

* Enter a **Project name** and click on **Continue**.
* Next, you will be asked whether you want to enable **Google Analytics** for the project. We won’t be needing analytics, as this is just a sample project. Click on **Create project**.
* If you want to enable Google Analytics anyway, then you will be prompted to select a Google Analytics account on the next screen:
* Wait for the project to be created, and you will be navigated to the **Firebase dashboard** of the project.

### Platform configurations <a href="#platform-configurations" id="platform-configurations"></a>

Now, we have to complete the platform-specific Firebase configurations. Though we are using Flutter (which is a cross-platform framework), we still have to integrate the Firebase project separately for each platform. Flutter 2.0 has support for Android, iOS and web in its stable channel, so we will be configuring for all three platforms.

#### Android setup <a href="#android-setup" id="android-setup"></a>

First of all, let’s configure for the **Android** platform.

![](https://364087463-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaeJXH0pTNZFPNJMUbR%2F-Maewp_jbVfs5_wTk7AG%2F-Maewyi6RHjbX4capWV_%2Ffirebase_6.png?alt=media\&token=52d333fd-9956-48c2-9788-c45f1d398543)

* Select the Android icon from the Firebase dashboard.
* Enter the Android package name, an app nickname and the SHA-1. Click on **Register app**.
* Download the `google-services.json` file, and place it in the **android -> app** directory. Click on **Next**.
* Just follow the instructions, and add the required code snippets to your project. Click on **Next**.
* You have successfully configured Firebase for Android. On the final step, click on **Continue to console** to go back to the dashboard.

#### iOS setup <a href="#ios-setup" id="ios-setup"></a>

* Select the iOS icon on the dashboard.
* Enter your iOS bundle ID and an app nickname. Click on **Register app**.
* Download the `GoogleService-Info.plist` file. Click on **Next**.
* Go back to your project, open the `ios` folder using **Xcode**, and drag and drop the file that you downloaded into the **Runner** subfolder. When a dialog box appears, make sure that **Runner** is selected in the “Add to targets” box. Then click **Finish**.
* You can skip steps 3 and 4, as they are automatically configured by the Flutter Firebase plugin that we will be adding soon. Click on **Continue to console** to go back to the dashboard.

{% hint style="info" %}
For a more graphical guideline, check the [link](https://blog.codemagic.io/firebase-authentication-google-sign-in-using-flutter/)
{% endhint %}
