Permalink
Browse files

Merge branch 'master' of github.com:bnoguchi/everyauth

  • Loading branch information...
bnoguchi committed Aug 8, 2012
2 parents e04500d + e06116f commit f481674750afa00f47222c6a9a95075751c26596
Showing with 18 additions and 3 deletions.
  1. +18 −3 lib/modules/tumblr.js
View
@@ -1,7 +1,8 @@
var oauthModule = require('./oauth')
, Parser = require('xml2js').Parser;
, Parser = require('xml2js').Parser
, url = require('url');
var twitter = module.exports =
var tumblr = module.exports =
oauthModule.submodule('tumblr')
.apiHost('http://www.tumblr.com/api')
.oauthHost('http://www.tumblr.com')
@@ -26,6 +27,20 @@ oauthModule.submodule('tumblr')
});
return promise;
})
.authCallbackDidErr( function (req) {
var parsedUrl = url.parse(req.url, true);
return !parsedUrl.query || !parsedUrl.query.oauth_token;
})
.handleAuthCallbackError( function (req, res) {
if (res.render) {
res.render(__dirname + '/../views/auth-fail.jade', {
errorDescription: 'The user denied your request'
});
} else {
// TODO Replace this with a nice fallback
throw new Error("You must configure handleAuthCallbackError if you are not using express");
}
})
.convertErr( function (data) {
return data.data;
return new Error(data.data);
});

0 comments on commit f481674

Please sign in to comment.