• Stars
    star
    267
  • Rank 152,766 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Best practices & demo for client-side authentication via Backbone.JS AJAX.

backbone-login

Best practices & demo app for client-side authentication via Backbone.js AJAX.

Blog article with further details and explanation can be found here.

The app demos the following:

  • CSRF headers in authentication requests to prevent forgery
  • Auth state persistence through signed cookies
  • Global (singleton) session model whose state changes can be listened to
  • Client-side validations through ParsleyJS
  • Salt/hashing of passwords for back-end storage

Client-Side

Uses a persistent global Backbone.js SessionModel to manage state. Views and other models all can:

  • subscribe to changes in session state
  • extract current user data
  • trigger auth events (login, logout, etc)

Server-Side

A lightweight, single-file Express.js server and SQLLite3 db. Responds to API routes, as well as initial index.html page render to plant the session CSRF token.

Install & Run

git clone https://github.com/alexanderscott/backbone-login.git
cd backbone-login
npm install
node server.js

Then visit http://localhost:3000 in a browser.

Contribute

Please fork and submit a pull request with adequate details.

License

The MIT License (MIT)

Copyright (c) 2013-2015 Alex Ehrnschwender

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

iconerator

Generates all app market icons (iOS + Android + Web favicons) from a single input image
JavaScript
44
star
2

HackerRank

Solutions to various HackerRank.com problems
Java
31
star
3

rails-twitter-sse

Live twitter feed using Rails 4 streams, SSEs, threads, Twitter Streaming API, and Redis Pub/Sub
Ruby
21
star
4

node-deploy-hook

Lightweight Node.JS git deployer to be used with Bitbucket or Github POST service hooks
JavaScript
19
star
5

redis-lua-samples

Some useful Lua scripts for common Redis operations.
Lua
15
star
6

mirror-quickstart-nodejs

Unofficial Google Mirror API's Quickstart for Node.js (using Express)
JavaScript
4
star
7

node-tictactoe

Tic-tac-toe on the command-line via nodejs readline
JavaScript
4
star
8

node-mirror-api-client

Google Mirror API client for managing Glass timeline items, contacts, and subscriptions.
JavaScript
4
star
9

youtube-csv-dl

download audio files from a list of songs
JavaScript
4
star
10

handlebars-helpers

Collection of useful handlebars helpers for FE templating
JavaScript
3
star
11

akka-twitter-streaming-cluster

Scala
2
star
12

node-analytics

Lightweight UDP analytics server for Mixpanel, StatsD, and CSV logging
JavaScript
2
star
13

dotfiles-remote

remote linux dotfiles
Shell
2
star
14

burrito-bot

Slack bot similar to HeyTaco, to give teammates kudos
Python
2
star
15

node-boilerplate

Boilerplate node.js project generator
JavaScript
1
star
16

streamline

stream songs, artists, and albums from the terminal
Ruby
1
star
17

zanalyze

Print basic stats about a Redis ZSET
JavaScript
1
star
18

s3-screensaver

Host an interactive gallery of photos from an s3 bucket
JavaScript
1
star