andbang-express-auth
Advanced tools
Comparing version 0.0.1 to 0.0.2
21
index.js
@@ -60,8 +60,12 @@ var _ = require('underscore'), | ||
this.app.get('/auth', function (req, res) { | ||
var url = self.accountsUrl + '/oauth/authorize?' + querystring.stringify({ | ||
response_type: 'code', | ||
client_id: self.clientId, | ||
type: 'web_server' | ||
}); | ||
res.redirect(url); | ||
if (req.session.accessToken) { | ||
res.redirect(self.defaultRedirect); | ||
} else { | ||
var url = self.accountsUrl + '/oauth/authorize?' + querystring.stringify({ | ||
response_type: 'code', | ||
client_id: self.clientId, | ||
type: 'web_server' | ||
}); | ||
res.redirect(url); | ||
} | ||
}); | ||
@@ -108,3 +112,4 @@ | ||
req.session.destroy(); | ||
res.redirect(this.loggedOutRedirect); | ||
res.clearCookie('accessToken'); | ||
res.redirect(self.loggedOutRedirect); | ||
}); | ||
@@ -130,2 +135,2 @@ | ||
module.exports = new AndBangMiddleware(); | ||
module.exports = new AndBangMiddleware(); |
{ | ||
"name": "andbang-express-auth", | ||
"description": "Dead simple And Bang auth middleware.", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"dependencies": { | ||
@@ -11,2 +11,2 @@ "express": "3.x", | ||
"main": "index.js" | ||
} | ||
} |
7039
146