简体   繁体   English

如何在不使用ember cli或AMD的情况下使用ember简单身份验证

[英]how to use ember simple auth without ember cli or AMD

we are re-writing our web application in ember.js. 我们正在ember.js中重写我们的Web应用程序。 we use our rest api and the api uses oAuth 2.0 authentication system. 我们使用rest api,而api使用oAuth 2.0身份验证系统。 Now, we are trying to use ember simple auth https://github.com/simplabs/ember-simple-auth and we also tried to use https://github.com/Vestorly/torii but it seems both needs to have AMD loader or ember cli. 现在,我们尝试使用ember简单身份验证https://github.com/simplabs/ember-simple-auth ,我们也尝试使用https://github.com/Vestorly/torii,但似乎两者都需要AMD装载机或余烬cli。 Unfortunately we are not using any of them. 不幸的是,我们没有使用它们中的任何一个。 I would like to know what people using for authentication for oAuth2.0. 我想知道什么人用于oAuth2.0身份验证。 Thanks in advance. 提前致谢。

Update: I downloaded ember simple auth 0.7.0 from distribution. 更新:我从发行版下载了ember simple auth 0.7.0。 But how do I configure with my ember application. 但是,如何使用余烬应用程序进行配置。 I tried use it like this; 我试过像这样使用它; But it didn't work. 但这没有用。

Ember.Application.initializer({
    name:       'authentication',
    after:      'simple-auth',
    initialize: function(container, application) {
        var applicationRoute = container.lookup('route:application');
        var session          = container.lookup('simple-auth-session:main');
        // handle the session events
        session.on('sessionAuthenticationSucceeded', function() {
            applicationRoute.transitionTo('index');
        });
    }
});
var ApplicationRouteMixin = requireModule('simple-auth/mixins/application-route-mixin')['default'];

in my route like this: 在我的路线上是这样的:

App.ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, {});

@marcoow do you have any example ? @marcoow你有什么例子吗?

Ember Simple Auth also has a distribution that exports a global ( SimpleAuth ) - download here: https://github.com/simplabs/ember-simple-auth/releases/tag/0.7.0 Ember Simple Auth还具有导出全局( SimpleAuth )的发行版-在此处下载: https : //github.com/simplabs/ember-simple-auth/releases/tag/0.7.0

You should really use Ember CLI of course though... 您当然应该真正使用Ember CLI ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM