> For the complete documentation index, see [llms.txt](https://enappd-apps.gitbook.io/apps/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enappd-apps.gitbook.io/apps/ionic-4-full-app/main-features/firebase.md).

# Firebase

Use Firebase authentication, upload, storage, CRUD functionalities

## Authentication Using Firebase

This starter provides you with Login, Signup and Reset Password functionality using Firebase Authentication.&#x20;

You can test the authentication in the already provided app code.

When you want to attach the authentication process to your own Firebase project, simply get the `config` parameters from Firebase console.

![](https://3065094597-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La-kqVz2Uq1Ka0VUWZT%2F-LaEjiQVp-C8c0r1dybd%2F-LaElvVc5Aa7KHPX7sxK%2FScreen%20Shot%202019-03-18%20at%201.19.36%20PM.png?alt=media\&token=17c84ff9-db03-489f-a3e1-284f4a2f2310)

Once you have the `config` parameters, paste them in the `environment` files in the starter code. There are two environment files, one for `dev` and one for `prod` app.

![Environment files for Firebase config](https://3065094597-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La-kqVz2Uq1Ka0VUWZT%2F-LaEjiQVp-C8c0r1dybd%2F-LaEmK7O-MJVucteYXlk%2FScreen%20Shot%202019-03-18%20at%201.21.15%20PM.png?alt=media\&token=7cd50024-84d3-4903-9351-ec0c6cf243bb)

This configuration can be imported in `app.module.ts` and `main.ts` by importing the `environment`&#x20;

```
import { environment } from 'src/environments/environment';
```

{% hint style="info" %}
Make sure to have the `config` in the `environment.prod.ts` when you create a production build
{% endhint %}

## Code Structure

![Folders for Firebase features](https://3065094597-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La-kqVz2Uq1Ka0VUWZT%2F-LaEmb0hESB4XNMD_PVh%2F-LaEo2PLf9j4zO601bsG%2FScreen%20Shot%202019-03-18%20at%201.29.00%20PM.png?alt=media\&token=8ff66e5f-3073-4c7d-8377-a811100b2343)

The `src/app/pages/firebase` folder contains the code related to&#x20;

* Login - Email login
* Signup - Email signup
* Image Upload
* CRUD data functions - `firebase-home`

These files use service data and functions provided in `src/app/services/firestore`&#x20;

* `filestorage.service.ts` - For storage purpose
* `firebase-authentication.service.ts` - For Authentication functions
* `firestore.services.ts` - For CRUD functions

{% hint style="info" %}
When you are using the app Sidemenu, the **Login** option actually performs a **Logout** actions to take you to the Login page.
{% endhint %}
