A basic example implementation of how we are currently handling authentication in Ember. This example uses Ember CLI 0.0.37 for the front-end and rails 4.1 for the backend api.
Most of the Ember authentication code was taken from Eric Berry's great blog post. We had to make a bunch of changes to get it to work with the Ember 1.5.1 and Ember CLI but the mechanics are basically the same.
If you are just getting started with Ember CLI checkout DockYard's great blog series.
note: This was last tested against Ember CLI 0.0.37. Ember CLI is under heavy development and in constant flux, we recommend you make sure our example is working against 0.0.37 before upgrading to a newer version of Ember CLI.
You can probably get away with using slightly different versions but this is what we were using at the time.
- Node.js - 0.10.28
- Ruby - 2.1.2
- Rails - 4.1.0
- ember-cli - 0.0.37
- Postgres
- run
git clone git@github.com:greenfieldhq/ember-authentication.git
- run
npm install -g ember-cli
- cd into
/ember-authentication
- cd into
/ember
and runbower install
- cd into
/rails
and runbundle install
- while in
/rails
, runrake db:setup
- inside
/ember
runember server --proxy http://localhost:3000
- inside
/rails
runrails s
Assuming it's all running you should be able to point your browser at http://localhost:4200 and see the sample application. The "Top Secret" link requires authentication, click it and you'll be prompted for your credentials.
You can look at rails/db/seeds.rb to use one of the test user accounts. Alternatively you can click the "Register" link and create your own.
There a few QUnit tests, run them by going to http://localhost:4200/tests