Using OAuth2 with Ember Simple Auth
OAuth2 specifies authorization flows for web applications. We can use it with Ember to secure our application and provide data to only those users that are authorized. In this recipe, we'll look at using OAuth2 with Ember Simple Auth (ESA), a robust add-on for Ember.
ESA will handle our client-side session and authentication and send the requests to the server. It's very customizable and extensible. Although it can be complicated, just like our last recipe, we'll create a protected students route that can be accessed by authorized users only.
Getting ready
For the purposes of this example, we'll need an OAuth2 server. Setting up an OAuth2 server is beyond the scope of this recipe. There are several OAuth2 libraries ...
Get Ember.js Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.