# ember-on-fire

> An alternative supported adapter for using Firebase with Ember

Latest version **0.2.3** (published 2020-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-on-fire
pnpm add ember-on-fire
yarn add ember-on-fire
bun add ember-on-fire
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2020-11-12 |
| First published | 2020-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 10.* \|\| >= 12 |
| Dependencies | 4 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Gianluca Tomasino |
| Maintainers | gianluca.tomasino |
| Keywords | ember-addon, firebase |

## Links

- npm: https://www.npmjs.com/package/ember-on-fire
- Repository: https://github.com/gianlucatomasino/ember-on-fire
- Homepage: https://gianlucatomasino.github.io/ember-on-fire
- Issues: https://github.com/gianlucatomasino/ember-on-fire/issues
- npm.io page: https://npm.io/package/ember-on-fire

## Dependencies (4)

- [firebase](https://npm.io/package/firebase.md) ^8.0.1
- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^7.22.1
- [ember-simple-auth](https://npm.io/package/ember-simple-auth.md) ^3.0.0
- [ember-cli-htmlbars](https://npm.io/package/ember-cli-htmlbars.md) ^5.3.1

## Recent versions

- 0.2.3 (latest) — 2020-11-12
- 0.2.2 — 2020-10-13
- 0.2.1 — 2020-10-06
- 0.2.0 — 2020-09-29
- 0.1.6 — 2020-09-25
- 0.1.5 — 2020-09-23
- 0.1.4 — 2020-09-16
- 0.1.3 — 2020-09-15
- 0.1.2 — 2020-09-15
- 0.1.0 — 2020-09-14

## README

ember-on-fire
==============================================================================

Ember OnFire is an adapter for use Firebase with Ember. 
Currently the following are the services implemented:
 
 - **Ember Data Adapters**: [Cloud Firestore](https://firebase.google.com/docs/firestore/) adapters for Ember Data allow you to persist your models in Firebase
 - **Authentication Providers** - Integrate [Firebase Authentication](https://firebase.google.com/docs/auth/) with your Ember application easily with providers for [Ember Simple Auth](http://ember-simple-auth.com/)

Installation
------------------------------------------------------------------------------

```
ember install ember-on-fire
```

Add configuration to 

```js
let ENV = {
    firebase: {
      apiKey: "key",
      authDomain: "app.firebaseapp.com",
      databaseURL: "https://app.firebaseio.com",
      projectId: "app",
      storageBucket: "app.appspot.com",
      messagingSenderId: "1234567890"
    }
}
```

Example use
------------------------------------------------------------------------------
```js
// app/authenticators/password.js
import FirestoreAdapter from 'emberfire/adapters/firestore';

import FirebasePasswordAuthenticator from 'ember-on-fire/authenticators/firebase-password';

export default class PasswordAuthenticator extends FirebasePasswordAuthenticator {}
```

```js
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';

export default class SampleController extends Controller {
    @service firebaseApp;
    @service session;

    @action
    async login() {
        try {
            await this.session.authenticate('authenticator:password', 'gianluca.tomasino@gmail.com', 'password');
        } catch(error) {
            this.errorMessage = error.error || error;
        }

        if (this.session.isAuthenticated) {
            //Logic after login
        }
    }

    @action
    async logout() {
        await this.session.invalidate();

        //Logic after logout      
    }
}
```

## Documentation

* [Quickstart](docs/quickstart.md)
* [Guide](docs/guide/README.md)

Contributing
------------------------------------------------------------------------------

See the [Contributing](CONTRIBUTING.md) guide for details.


License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).

---
_Source: https://npm.io/package/ember-on-fire · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
