ember.jsember-cliember-cli-addonstorii

Torii Configuration is not being loaded in ember cli


I'm having a lot of trouble getting ember simple auth with torii working at all at the moment using Ember CLI.

After creating a new Ember CLI app and installing torii, ember-cli-simple-auth and ember-cli-simple-auth-torii, I have a couple of buttons on my login page

Here is the contents of my routes/login.js:

import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
    googleLogin: function() {
      this.get('session').authenticate('simple-auth-authenticator:torii', 'google-oauth2');
      return;
    },
    facebookLogin: function() {
      this.get('session').authenticate('simple-auth-authenticator:torii', 'facebook-oauth2');
      return;
    }
  }
});

The relevant part of my environment.js file is:

var ENV = {

...
torii: {
  providers: {
    'google-oauth2': {
      apiKey: 'api-key-here',
      scope: 'profile',
      redirectUri: 'http://localhost:4200'
    },
    'facebook-oauth2': {
      apiKey:      'api-key-here',
      redirectUri: 'http://localhost:4200'
    }
  }
},
...
};

When I hit the actions in my login.js, I get the following error:

Error: Expected configuration value providers.facebook-oauth2.apiKey to be defined!

or

Error: Expected configuration value providers.google-oauth2.apiKey to be defined!

Why is torii not picking up my environment.js configuration?


Solution

  • Turns out my problem was a simple one, the ember serve process needed to be restarted (Ctrl + c, and then re run ember serve).