codecombat/server/lib/gplus.coffee

12 lines
357 B
CoffeeScript
Raw Normal View History

2016-06-30 18:32:58 -04:00
request = require 'request'
Promise = require 'bluebird'
module.exports.fetchMe = (gplusAccessToken) ->
return new Promise (resolve, reject) ->
url = "https://www.googleapis.com/oauth2/v2/userinfo?access_token=#{gplusAccessToken}"
request.get url, {json: true}, (err, res) ->
if err
reject(err)
else
resolve(res.body)