Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update to latest express; better error handling

  • Loading branch information...
commit 01f827174b39efa818c705cd066cb38a7e7693a0 1 parent cd0cc0d
@gerad gerad authored
Showing with 6 additions and 5 deletions.
  1. +3 −2 lib/twitter_client.js
  2. +3 −3 test/client.js
View
5 lib/twitter_client.js
@@ -77,7 +77,7 @@ module.exports = function (api_key, api_secret, redirect) {
parsedUrl.query.oauth_verifier,
function (error, oauth_token, oauth_token_secret, additionalParameters) {
if (error) {
- callback(null, null);
+ callback(error, null);
} else {
callback(null, {oauth_token: oauth_token, oauth_token_secret: oauth_token_secret});
}
@@ -95,8 +95,9 @@ module.exports = function (api_key, api_secret, redirect) {
req.session.auth.twitter_oauth_token_secret = oauth_token_secret;
req.session.auth.twitter_oauth_token = oauth_token;
res.redirect("http://api.twitter.com/oauth/authorize?oauth_token=" + oauth_token);
+ } else {
+ callback(error, null);
}
- callback(null, null);
}
);
}
View
6 test/client.js
@@ -12,9 +12,9 @@ var express = require('express'),
'http://twitter-js.com:3003/'
),
app = express.createServer(
- connect.bodyDecoder(),
- connect.cookieDecoder(),
- connect.session()
+ connect.bodyParser(),
+ connect.cookieParser(),
+ connect.session({ secret: 'yourSecret' })
);
app.set('views', __dirname);
Please sign in to comment.
Something went wrong with that request. Please try again.