From a9668a1999e66ebc5159f21dae7e04e9ce0f9ee1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 23 Dec 2013 14:44:35 +0000 Subject: [PATCH] Better error message if twitter auth flow fails Closes #123 --- nodes/core/social/27-twitter.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nodes/core/social/27-twitter.js b/nodes/core/social/27-twitter.js index f8c493812..120f70e81 100644 --- a/nodes/core/social/27-twitter.js +++ b/nodes/core/social/27-twitter.js @@ -283,10 +283,12 @@ RED.app.get('/twitter/:id/auth', function(req, res){ oauth_callback: req.query.callback },function(error, oauth_token, oauth_token_secret, results){ if (error) { - console.log(error); - res.send("yeah no. didn't work.") - } - else { + var resp = '

Oh no!

'+ + '

Something went wrong with the authentication process. The following error was returned:

'+ + '

'+error.statusCode+': '+error.data+'

'+ + '

One known cause of this type of failure is if the clock is wrong on system running Node-RED.'; + res.send(resp) + } else { credentials.oauth_token = oauth_token; credentials.oauth_token_secret = oauth_token_secret; res.redirect('https://twitter.com/oauth/authorize?oauth_token='+oauth_token)