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

How to do Ember.SimpleAuth.setup using ember-simple-auth via AMD

Marco Otte-Witte
Mar 07, 2015
<p>You must not call <code>SimpleAuth.setup</code> anymore as it's private API now. If you're using Ember CLI simply install the Ember CLI addon: <a href="https://github.com/simplabs/ember-cli-simple-auth" rel="nofollow">https://github.com/simplabs/ember-cli-simple-auth</a>. If you're using EAK (in which case you should migrate to Ember CLI anyway), make sure you require the Ember Simple Auth autoloader:</p> <p><code> require('simple-auth/ember'); </code></p> <p>Also checkout the installation instructions in the README: <a href="https://github.com/simplabs/ember-simple-auth#installation" rel="nofollow">https://github.com/simplabs/ember-simple-auth#installation</a></p> <p>In both cases you don't have to call <code>SimpleAuth.setup</code>. If you want to register your custom authenticator, simply add an initializer that runs before the 'simple-auth' initializer:</p> <pre><code>import Oauth2Authenticator from '../services/authenticator'; export default { name: 'authentication', before: 'simple-auth', initialize: function(container, app) { container.register('authenticator:api', Oauth2Authenticator); } }; </code></pre> <p>Configuration is now done via the global <code>ENV</code> object - see API docs here: <a href="http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html#SimpleAuth-Configuration" rel="nofollow">http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html#SimpleAuth-Configuration</a></p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/24543777/How%20to%20do%20Ember.SimpleAuth.setup%20using%20ember-simple-auth%20via%20AMD/24546965">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