I am little confused on how to use ember-simple-auth with torii
I am using ember-cli-simple-auth and ember-cli-simple-auth-torii
i am getting below mentioned error
dont know waht i am missing
Uncaught Error: Assertion Failed: No application initializer named 'torii'
routes.js
Router.map(function() {
this.route('login');
this.route('application');
this.route('protected');
});
app/routes/application.js
import Ember from 'ember';
import ApplicatonRouteMixin from 'simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicatonRouteMixin);
app/route/login
import Ember from 'ember';
export
default Ember.Route.extend({
actions: {
// action to trigger authentication with Facebook
authenticateWithFacebook: function () {
this.get('session').authenticate('simple-auth-authenticator:torii', 'facebook-oauth2');
}
}
});
app/routes/protected
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend( AuthenticatedRouteMixin);
app/initializers/torii-initializer.js
import ToriiAuthenticator from 'simple-auth-torii/authenticators/torii';
export default Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
// register the Torii authenticator so the session can find them
container.register('simple-auth-authenticator:torii', ToriiAuthenticator);
Ember.SimpleAuth.setup(container, application);
}
});
index.html
window.AuthENV = {
{
ENV
}
};
window.EmberENV = window.AuthENV.EmberENV;
window.ENV = window.ENV || {};
window.ENV['torii'] = {
providers: {
'facebook-oauth2': {
apiKey: '63125ss',
redirectUri: document.location.href
}
}
};
login template
<h1>Login</h1>
<a {{action "authenticateWithFacebook"}}> login</a>