Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Tower.js with Passport demo app

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 public
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .npmignore
Octocat-spinner-32 .slugignore
Octocat-spinner-32 Cakefile
Octocat-spinner-32 Procfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Watchfile
Octocat-spinner-32 config.json
Octocat-spinner-32 package.json
Octocat-spinner-32 server.js
README.md

Tower-Authentication-Example

Note, this is a work in progress, it's not fully setup yet.

See ./config/initializers/passport.coffee to see how the wrapper is built internally.

This is how it's being used:

# config/bootstrap.coffee
App.configure ->
  @use 'favicon', Tower.publicPath + '/favicon.png'
  @use 'static',  Tower.publicPath, maxAge: Tower.publicCacheDuration
  @use 'profiler' if Tower.env != 'production'
  @use 'logger'
  @use 'query'
  @use 'cookieParser', Tower.config.session.key
  @use 'session', secret: Tower.config.session.secret, cookie: {domain: Tower.config.session.cookie.domain}
  @use 'bodyParser', uploadDir: './public/uploads'

  Tower.Auth.initialize ->
    @provider 'twitter'
    @provider 'facebook', url: 'local.host:1597'
    @provider 'github'
    @provider 'google'
    @provider 'linkedin'

  #@use 'csrf'
  @use 'methodOverride', '_method'
  @use Tower.Middleware.Agent
  @use Tower.Middleware.Location
  @use Tower.Middleware.Router
# config/routes.coffee
Tower.Route.draw ->
  @match '/auth/:provider/callback', to: 'sessions#create'

  @match '/', to: 'application#welcome'
class App.SessionsController extends Tower.Controller
  create: ->
    App.User.findOrCreateFromSession @request.authHash, (error, user) =>
      @render json: user

Todo

  • login with any of passport's strategies
  • send email once to users if they login with email
  • show counter on icons for each provider to show how many have logged in.
Something went wrong with that request. Please try again.