0.2.3 • Published 4 years ago

ember-on-fire v0.2.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

ember-on-fire

Ember OnFire is an adapter for use Firebase with Ember. Currently the following are the services implemented:

Installation

ember install ember-on-fire

Add configuration to

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

Example use

// 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 {}
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

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago