mercredi 20 mai 2015

Github OAuth flow with Express and Ember.js

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('http://ift.tt/1EkQtUD')
  })

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('http://ift.tt/1SfGHOb' + 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?




Aucun commentaire:

Enregistrer un commentaire