Ember-Simple-Auth和Torii

时间:2015-11-30 19:52:33

标签: authentication ember.js

我在连接ember-simple-auth和torii时遇到问题,以便进行facebook身份验证。

我的配置/ environment.js:

torii: {
  providers: {
    'facebook-oauth2': {
      apiKey: 'my_api_key'      
    }
  }
}

的package.json:

"ember-simple-auth": "1.0.1",
"torii": "0.6.1"

控制器/ application.js中:

import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';

export default Ember.Controller.extend(ApplicationRouteMixin, {
    session: Ember.inject.service('session'),
    torii: Ember.inject.service(),
    actions: {
        authenticateWithFacebook: function(){
          this.get('session').authenticate(
            'simple-auth-authenticator:torii',
            'facebook-oauth2'
          ).then(
            function(data) {
              alert('SUCCESS ' + data);
            },
            function(error) {
              alert('There was an error when trying to sign you in: ' + error);
            }
          );
        }
    }   
});

应用程序/认证器/ torii.js:

import ToriiAuthenticator from 'ember-simple-auth/authenticators/torii';

export default ToriiAuthenticator.extend({
  torii: Ember.inject.service()
});

虽然我可以使用torii连接facebook,但此示例失败并出现以下错误:

未捕获错误:断言失败:找不到工厂“simple-auth-authenticator:torii”的验证器!

有什么想法吗?我使用最新的ember-cli版本。

0 个答案:

没有答案