   saveOauthToSession resp, clientId, provider, (err) ->
     options = { provider, returnUrl }
     redirectOauth err, req, res, options
+
+
+fetchUserEmail = (req, res, clientId, userEmailResp, originalResp) ->
+  rawResp = ''
+  userEmailResp.on 'data', (chunk) -> rawResp += chunk
+  userEmailResp.on 'end', ->
+    try
+      emails = JSON.parse(rawResp)
+    catch e
+      return redirectOauth 'could not parse github response', req, res, { provider }
+
+    for email in emails when email.verified and email.primary
+      originalResp.email = email.email
+
+    saveOauthAndRedirect originalResp, res, clientId, req
+
 
 module.exports = (req, res) ->
   { code, returnUrl } = req.query

    headers : headers
  r = http.request options, authorizeUser
  r.end()

          path    : "/user/emails?access_token=#{access_token}"
          method  : 'GET'
          headers : headers
        r = http.request options, (newResp) ->
          fetchUserEmail req, res, clientId, newResp, resp
        r.end()
      else
        saveOauthAndRedirect resp, res, clientId, req

  path = '/login/oauth/access_token?'
  path += "client_id=#{github.clientId}&"
