Skip to content

holandes22/ember-persona-example

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Using Mozilla Person Login with Ember.js

This is a simple ember app to show user authentication using Mozilla Persona

The app shows a list of cars that belong to the user (No UI for this atm, add them from the admin console of django).

The technologies used:

Architecture

A Client-Server architecture is used. The backend provides a simple REST API:

/users
/users/:id
/cars
/cars/:id
/auth/login

The REST API uses a Token authentication scheme

Login process

- A user fires up a login request. The Persona dialog is presented.
- The auth assertion is passed to the client.
- The client sends a POST request to /auth/login with the assertion
- The server tries to authenticate the user (by calling Mozilla's verify service) and responds with email and 
  API token if succeds or 500 if not. The server creates a new user if none associated with that email.
- The client stores the API Token for the session (used by ember-data adapter to consume the REST API)

Installation

The frontend uses Ember APP Kit as a skeleton. After cloning the repo:

cd ember-persona-example/frontend
npm install
grunt server (runs server at port 8000)

For the backend

cd ember-person-example/backend
# python, so we create a virtualenv, I use virtualenvwrapper here, you should too
mkvirtualenv ember-persona-example
pip install -r requirements
python manage.py syncdb
python managa.py runserver 8888

Open a browser and go to http://localhost:8000. Go to the login section and press the login with Persona button to authenticate.

TODO

  • deploy to heroku
  • Vagrant for dev env
  • dev install script
  • Allow car add/delete/edit

About

Example to use Persona sign-in using Ember.js and Django REST Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published