 request = require 'superagent'
 express = require 'express'
 passport = require 'passport'
-FacebookStrategy = require('passport-facebook').Strategy
-TwitterStrategy = require('passport-twitter').Strategy
 LocalStrategy = require('passport-local').Strategy
 qs = require 'querystring'
 crypto = require 'crypto'

  app.use passport.session()
  app.post opts.loginPath, localAuth, afterLocalAuth
  app.post opts.signupPath, signup, passport.authenticate('local'), afterLocalAuth
  app.get opts.twitterPath, socialAuth('twitter')
  app.get opts.facebookPath, socialAuth('facebook')
  app.get opts.twitterCallbackPath, socialAuth('twitter'), socialSignup('twitter')
  app.get opts.facebookCallbackPath, socialAuth('facebook'), socialSignup('facebook')
  app.get opts.twitterLastStepPath, loginBeforeTwitterLastStep
  app.post opts.twitterLastStepPath, submitTwitterLastStep
  app.use headerLogin
  app.use addLocals


    try
      err = JSON.parse(res.text).error_description
      err ?= JSON.parse(res.text).error
    err ?= "Arena returned a generic #{res.status}" if res.status > 400
    err ?= "Arena returned no access token and no error" unless res.body.access_token?
    err ?= e

    # If there are no errors create the user from the access token
    unless err
      return done(null, new opts.CurrentUser(accessToken: res.body.access_token))

    # Invalid email or password
    else if err.match?('invalid email or password')
