Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tower.js with Passport demo app
CoffeeScript JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db
public
test
vendor
.gitignore
.npmignore
.slugignore
Cakefile
Procfile
README.md
Watchfile
config.json
package.json
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.