New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does this integrate well with OAuth? (Google/twitter/etc) #11
Comments
Currently there isn't anything built in besides regular credentials based authentication. However, it's pretty easy to customize. The only 3 things you have to do is to implement your own App.LoginController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerMixin, {
actions: {
login: function() {
var oAuthToken = //somehow retrieve the OAuth token here (an potentially exchange it against a custom token with your own server)...
self.get('session').setup(oAuthToken);
//if the user was redirected here, redo the originally attempted transition so they get redirected to their original route after they logged in
var attemptedTransition = self.get('session.attemptedTransition');
if (attemptedTransition) {
attemptedTransition.retry();
self.set('session.attemptedTransition', null);
} else {
self.transitionToRoute(Ember.SimpleAuth.routeAfterLogin);
}
}
}
}); plus you need to override the Ember.Application.initializer({
name: 'authentication',
initialize: function(container, application) {
Ember.SimpleAuth.Session.reopen({
//the original code reads the auth token from the response JSON of the POST /session request
setup: function(oAuthToken) {
this.set('authToken', oAuthToken);
}
});
Ember.SimpleAuth.setup(application);
}
}); Also, instead of the original logout code that issues a App.LogoutRoute = Ember.Route.extend({
beforeModel: function() {
this.get('session').destroy();
}
}); |
Thanks @marcoow - I'll be sure to give this library a shot once I'm there! |
Hi, Is there a way currently to authenticate using google with the latest version ? |
Now you can use Torii: #273 (comment) |
No description provided.
The text was updated successfully, but these errors were encountered: