Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #290 from sstrigler/master

fix for #289
  • Loading branch information...
commit e06116f80a301c73acdc2864959b7ecec39fe18b 2 parents 61ccea8 + 46ca603
@bnoguchi authored
Showing with 18 additions and 3 deletions.
  1. +18 −3 lib/modules/tumblr.js
View
21 lib/modules/tumblr.js
@@ -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);
});
Please sign in to comment.
Something went wrong with that request. Please try again.