# Firebase Integration Into User App

{% embed url="https://www.youtube.com/watch?v=nHUMjzW9tZc&t=48s" %}

1. [**Editing environment files in project**](#1-editing-environment-files-in-project)
2. [**Creating database in Firebase**](#2-creating-database-in-firebase)
3. [**Enable Sign In Provider**](#3-enable-sign-in-provider)
4. [**Sign in using demo email ID**](#4-sign-in-using-our-email-id)
5. [**Test the user app**](#5-test-the-user-app)

### &#x20;1. Editing environment files in project

Open the project in your code editor and navigate as follows:-

Src -> Environments -> “environments.ts”



The code to be replaced is shown and highlighted below. Replace the highlighted code below with the code you copied to text editor from firebase in previous step.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M57z8HXQHljfJEosXzB%2FScreenshot%202020-04-17%20at%207.21.09%20PM.png?alt=media\&token=9e047292-fc02-4320-940b-a0598cc94c3e)

\
Now open **environments.prod.ts** file from **Environments** folder.



The code to be replaced is shown and highlighted below. Cut the highlighted code shown below. Paste the code you copied to text editor from firebase in previous step here.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M57zQRZ0hxt6KW0uXQh%2FScreenshot%202020-04-17%20at%207.23.14%20PM.png?alt=media\&token=61738565-53f1-4f3b-973b-ba1728bc1292)

###

### 2. Creating database in Firebase

The image shown below is the same screen we saw after competing all the steps of [New Firebase Project Setup](firebase-project-setup) section in firebase console. Click on “Continue to console” button.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M57zbQirxeKXETjiwVa%2FScreenshot%202020-04-17%20at%207.25.19%20PM.png?alt=media\&token=d1ff119b-8c75-4864-8633-312062ad4d12)



You should see the following screen where your app will be added to firebase.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M57zi7M-lbrz_xpubP8%2FScreenshot%202020-04-17%20at%207.26.20%20PM.png?alt=media\&token=8913914a-bade-4435-be92-d14af52bbc92)

\
Click on “database”  shown under the "Develop" section.It should show you the following screen and click on “Create database”&#x20;

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M57zyAXi7TTePdmnZhf%2FScreenshot%202020-04-17%20at%207.30.04%20PM.png?alt=media\&token=f555a55f-8ab7-44eb-b7b2-3e0fc84d7643)



Select “Start in test mode” and click “Next” as shown below.&#x20;

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M58-I8k_BQQ6bIqrSlp%2FScreenshot%202020-04-17%20at%207.31.44%20PM.png?alt=media\&token=988837d1-7cd2-4d74-8d73-a01ac8465df0)



Click on “Done”. It should show you the following screen.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M58-WlIZmgL6nszLwvS%2FScreenshot%202020-04-17%20at%207.32.51%20PM.png?alt=media\&token=89969231-7623-464a-8ffd-ad1275049a32)



Open your app running on localhost as shown below and refresh it.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M58-hMzMmdnLctuaaQ8%2FScreenshot%202020-04-17%20at%207.34.27%20PM.png?alt=media\&token=7a84487d-76db-4fbe-9649-0bc76566d721)



Click on “register” and it should show you the following screen. Fill your details to sign up as a user for the app and click “Next”.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M580-45jxl3uBT3HLKL%2FScreenshot%202020-04-17%20at%207.36.33%20PM.png?alt=media\&token=3516202a-9e87-4196-9eed-9d166da68c6f)



As you can see below the sign in provider is disabled for this firebase project. Click on "Done"

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M5B5IqC2JcZKn9vOKPF%2F-M5B8gHlaMcsgghy0cqY%2FScreenshot%202020-04-18%20at%2012.47.07%20PM.png?alt=media\&token=3295df5a-9ea3-4a49-9de8-d210b808439b)

###

### 3. Enable Sign In Provider

Let us go to Firebase console to enable "sign in". Click on “Authentication” shown under the "Develop" section. It should show you the following screen.&#x20;

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M580Ni1NtEhp9vBephY%2FScreenshot%202020-04-17%20at%207.38.15%20PM.png?alt=media\&token=09e17272-ed6d-4ebd-b547-9cb7a95b95ce)



Click on "Sign in method". It should show you the following screen.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M580bfUNPhnW-D5I4rk%2FScreenshot%202020-04-17%20at%207.38.54%20PM.png?alt=media\&token=a1789988-3bae-4f69-b5b2-2257e75ede71)



Select the "Email/Password" at the top of this list of "Provider" (which is disabled currently). It should show you the following screen. "Enable" the first option and make sure that second one is "diasbled" and click “Save”.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M5819g4DaPF_PLdWJ1_%2FScreenshot%202020-04-17%20at%207.39.44%20PM.png?alt=media\&token=f57f5239-5ae9-4325-90f4-c083a6171daf)

###

### 4. Sign in using our email id

Let us go back to our app running on localhost as shown below and click “Next”.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M581O_8A7BotVsVfqkV%2FScreenshot%202020-04-17%20at%207.41.20%20PM.png?alt=media\&token=e134ecd1-eea8-46e1-82ed-5a04c59b1e1c)



You should be able to login now. Screen showing your current location on the map should appear now, as shown below.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M57xyafD2I72sHWEnsf%2F-M581_LnX_EV43QKI-dE%2FScreenshot%202020-04-17%20at%207.42.02%20PM.png?alt=media\&token=e5577cde-5b0f-4f81-bf1d-9f429abd9982)

###

### 5. Test the user app

Add a "Pick up location" and a "Destination location". Book a ride and you should be able to see the following screen after waiting for a while.

![](https://833912930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqKtay1j36CbfXCRwWg%2F-M5B5IqC2JcZKn9vOKPF%2F-M5BT4Jb88IgYOPdkZJg%2FScreenshot%202020-04-18%20at%202.05.06%20PM.png?alt=media\&token=601b425c-e13b-440f-9780-d2bf42410c48)

###

### Taxi driver App&#x20;

Now we have successfully completed running the Taxi user App. Let us run the taxi driver app so that we can test our Taxi app completely.&#x20;

Go to [Driver App Setup](../how-to-use-this-starter/setting-up-and-running-taxi-driver-app) section to see how to do it.
