× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

can I use ember-simple-auth with express/passport session domain cookies

Marco Otte-Witte
Mar 07, 2015
<p>Ember Simple Auth itself doesn't require the token. In most cases though the "authorizer" needs a token in order to inject it into requests going to your API server (see here: <a href="http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html#SimpleAuth-Authorizers-Base" rel="nofollow">http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html#SimpleAuth-Authorizers-Base</a>). If you're using cookies you don't actually need an authorizer though as the cookie will be sent to the server anyway letting it identify the authenticated user. In that case you could simply resolve with e.g. <code>{ authenticated: true }</code> from the <code>authenticate</code> method and check for that value in the <code>restore</code> method:</p> <pre><code>restore: function(data) { return new Ember.RSVP.Promise(function(resolve, reject) { if (data.authenticated) { resolve(data); } else { reject(); } }); } </code></pre> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/24963677/can%20I%20use%20ember-simple-auth%20with%20express/passport%20session%20domain%20cookies/24969148">Stack Overflow</a>.</p>

Get New Tutorials Delivered to Your Inbox

New tutorials will be sent to your Inbox once a week.

comments powered by Disqus