Comments (4)
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 login
action in App.LoginController
as sth. like this:
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 setup
method in Ember.SimpleAuth.Session
:
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 DELETE /session
request etc. you should implement your own logout that simply destroys the local session:
App.LogoutRoute = Ember.Route.extend({
beforeModel: function() {
this.get('session').destroy();
}
});
from ember-simple-auth.
Thanks @marcoow - I'll be sure to give this library a shot once I'm there!
from ember-simple-auth.
Hi, Is there a way currently to authenticate using google with the latest version ?
from ember-simple-auth.
Now you can use Torii: #273 (comment)
from ember-simple-auth.
Related Issues (20)
- Deprecation: `old-deprecate-method-paths` HOT 1
- Ember Simple Auth: The automatic session initialization is deprecated on Ember 3.28.4 HOT 9
- Is Torii addon abandonned ? HOT 9
- Ember 4.1.0: Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead. HOT 1
- Unhandled Promise error detected when using the manual session.setup function HOT 9
- When I logout of one tab the authenticated data still seems to be populated in another tab HOT 1
- React to authentication in a component via modifier HOT 2
- v2 addon format HOT 5
- Typescript error on accessing prohibitAuthentication HOT 3
- CookieStore is not initializing/syncing correctly HOT 2
- Dependency Dashboard
- CookieExpirationTime not being set HOT 2
- When syncing tabs (session store), schedule of the refresh token should be updated
- ember-polyfills.deprecate-assign deprication in Ember 4.4 HOT 2
- Action Required: Fix Renovate Configuration
- ESA's Application route hides host app's route when using pod layout & embroider HOT 5
- Access token does not persist HOT 1
- Neither of test apps work - did you stop maintaining it? HOT 1
- Missing deprecation guide for session events HOT 1
- test-app should use modern Octane syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-simple-auth.