Created
June 10, 2015 06:36
-
-
Save jeromyevans/c730047c0ec03cc188ee to your computer and use it in GitHub Desktop.
Request Xero Request Token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initiate the request to Xero to get an oAuth Request Token. | |
// With the token, we can send the user to Xero's authorize page | |
exports.requestXeroRequestToken = function(request, reply) { | |
oauth.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results) { | |
if (error) { | |
console.log(error); | |
return reply.view('failed'); | |
} | |
// store the token in the session created by the hapi yar plugin | |
request.session.set('oauth', { | |
token: oauth_token, | |
token_secret: oauth_token_secret | |
}); | |
// redirect the user to Xero's authorize url page | |
return reply.redirect(AUTHORIZE_URL+oauth_token); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment