ember-auth-engine

0.1.0 • Public • Published

ember-auth-engine

A simple auth addon for your Ember app.

Installation

  • npm install --save ember-auth-engine

Usage

You need to do two things to be able to use ember-auth-engine in your app. First, you need to set a few configuration options in your application's config/environment.js file:

ENV['ember-auth-engine'] = {
  host: 'https://api.example.com',
  authenticatedRoot: 'items'
};

At a bare minimum, you will need to set host and authenticatedRoot. However, most applications will likely need to specify a few other things. See here for all available configuration options.

The second required step is to mount the engine in your application's app/router.js file::

import Em from 'ember';
import config from './config/environment';
import { mount as mountAuth } from 'ember-auth-engine';

var Router = Em.Router.extend({
  location: config.locationType
});

Router.map(function() {
  mountAuth(this, function() {
    this.resource('someresourcerequiringauth');
    this.resource('anotherresourcerequiringauth');
  });
});

export default Router;

Once these two steps are done, your app will be rewarded with the following:

  • all the auth routes your app needs (login, forgotten password, etc)
  • a currentUser object available on all routes, controllers, and components
  • much, much more

Readme

Keywords

Package Sidebar

Install

npm i ember-auth-engine

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ragnarpeterson