2
votes

I am currently following this tutorial to authenticate my EmberApp with Firebase: Ember authentication with Firebase. I am working on the part which uses the Torii addon for authentication.

Here is what I have done so far:

app/torii-adapters/application.js

import Ember from 'ember';
import ToriiFirebaseAdapter from 'emberfire/torii-adapters/firebase';

export default ToriiFirebaseAdapter.extend({
  firebase: Ember.inject.service()
});

app/adapters/application.js

import config from '../../config/environment';
import FirebaseAdapter from 'emberfire/adapters/firebase';
import Firebase from 'firebase';

export default FirebaseAdapter.extend({
  firebase: new Firebase(config.firebase)
});

config/environment.js

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'my-auth-test',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    firebase: 'MY_FIREBASE_URL',
    torii: {
      sessionServiceName: 'session'
    },
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary             build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };
...

routes/application.js -> Login function

login: function() {
  var controller = this.get('controller');
  var email = controller.get('userEmail');
  var password = controller.get('userPassword');
  this.get('session').open('firebase', {
    provider: 'password',
    email: email,
    password: password
  }).then(function() {
    this.transitionTo('protected');
  }.bind(this));
}

The problem that I have is the following error: Please set the firebase property in your environment config.

But as far as I can see I have the property set. Can someone help me fix this issue?

1

1 Answers

3
votes

That's the old method. Recently I ran into a similar issue after copy/pasting my old implementation, but after a quick look at https://github.com/firebase/emberfire I updated my config/environment.js to the following and was able to get it to work.

Try:

// config/environment.js
var ENV = {
  firebase: {
    apiKey: 'xyz',
    authDomain: 'YOUR-FIREBASE-APP.firebaseapp.com',
    databaseURL: 'https://YOUR-FIREBASE-APP.firebaseio.com',
    storageBucket: 'YOUR-FIREBASE-APP.appspot.com',
  }