ember-cli-simple-auth を使用する前に、次の初期化子がありました。
Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
container.register('authenticator:api', Oauth2Authenticator);
Ember.SimpleAuth.setup(container, application, {
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer',
routeAfterAuthentication: 'dashboard',
routeAfterInvalidation: 'login',
storeFactory: 'ember-simple-auth-session-store:local-storage'
});
}
});
今それを行う方法、インポートを使用するとき、私は要点に到達することができました:
import Oauth2Authenticator from '../services/authenticator';
export default {
name: 'authentication',
initialize: function(container, app) {
container.register('authenticator:api', Oauth2Authenticator);
// THIS PART IS NOT CLEAR, HOW TO SETUP IN AMD?
Ember.SimpleAuth.setup(container, application, {
authorizerFactory: 'ember-simple-auth-authorizer:oauth2-bearer',
routeAfterAuthentication: 'dashboard',
routeAfterInvalidation: 'login',
storeFactory: 'ember-simple-auth-session-store:local-storage'
});
// END OF CONFUSING PART
}
};
ありがとう!