Skip to content

Instantly share code, notes, and snippets.

@cdl
Last active December 23, 2015 02:39
Show Gist options
  • Save cdl/6568126 to your computer and use it in GitHub Desktop.
Save cdl/6568126 to your computer and use it in GitHub Desktop.
app.get('/callback', function(req, res) {
var code = req.param('code');
var request = require('request');
var body = 'client_id=REDACTED&client_secret=REDACTED&grant_type=authorization_code&redirect_uri=http://textr.dev/callback';
var auth_request = request.post({
uri: 'https://account.app.net/oauth/access_token',
body: body,
headers: {
'Content-Length': body.length
}
}, function(err, header, body) {
if (!err) {
console.log('Response body: ' + body);
res.send('Response body: ' + body);
} else {
res.send("Error occured: " + err);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment