I'm pretty new to Express.js and the Github OAuth api and running into a wall.
The flow I've got going is, the user clicks on a link from the Ember.js application which points to a route on the Express server. Which redirects to the Github oauth route.
router.route('/oauth')
.get(function(req, res){
res.redirect('https://github.com/login/oauth/authorize?client_id=XXXX&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcallback&state=1234')
})
After the app is authenticated, the user gets redirected back to a callback route
router.route('/callback')
.get(function(req, res){
var code = req.query.code
res.redirect('https://github.com/login/oauth/access_token?client_id=XXXX&client_secret=YYYY&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fgood&code=' + code)
})
Which comes back with a code. From this point, I use that code to get an access token. The access token comes back but it comes back as a file that downloads to my machine instead of a response to my server. What am I missing?