Skip to content

Latest commit

 

History

History
 
 

ember-simple-auth-torii

The API docs for Ember Simple Auth torii are available here

Ember Simple Auth torii

This is an extension to the Ember Simple Auth library that provides an authenticator that wraps torii and thus supports a variety of 3rd party authentication providers. For using this extension library the Ember.js application also needs to load the torii library.

Ember Simple Auth torii requires Ember.js 1.6 or later!

The Authenticator

In order to use the torii authenticator (see the API docs for Authenticators.Torii) the application needs to configure one or more torii providers, e.g.:

ENV['torii'] = {
  providers: {
    'facebook-oauth2': {
      apiKey:      '631252926924840',
      redirectUri: document.location.href
    }
  }
};

To use this provider to authenticate the Ember Simple Auth session simply pass the provider's name to the authenticate method of the session:

this.get('session').authenticate('simple-auth-authenticator:torii', 'facebook-oauth2');

The torii provider has to implement the fetch method to revalidate the session after a refresh or when it changes. The fetch method is called with the data returned from the provider's open method.

Authorization

Ember Simple Auth torii doesn't include an authorizer. In typical flows you wouldn't use the authorization data obtained from the torii provider to authorize requests against your API server directly anyway but exchange that authorization data for a Bearer token for your API server first. That token could then be used e.g. with the Ember Simple Auth OAuth 2.0 authorizer.

Installation

To install Ember Simple Auth torii in an Ember.js application there are several options:

  • If you're using Ember CLI, just add the Ember CLI Addon to your project and Ember Simple Auth torii will setup itself.

  • The Ember Simple Auth torii extension library is also included in the "ember-simple-auth" bower package both in a browserified version as well as an AMD build. If you're using the AMD build from bower be sure to require the autoloader:

    require('simple-auth-oauth2/ember');

    The browserified version will, like the Ember CLI addon, also setup itself once it is loaded in the application.

  • Download a prebuilt version from the releases page