Merge branch 'hotfix/21.56.9' into master
[gitter.git] / server / api / private / irc-token.js
blob304b9d30b4896c5ec7b86a42cddab2a882be8a79
1 'use strict';
3 var oauthService = require('gitter-web-oauth');
4 var restSerializer = require('../../serializers/rest-serializer');
5 var Promise = require('bluebird');
7 module.exports = function(req, res, next) {
8 var strategy = new restSerializer.UserStrategy();
10 return Promise.join(
11 restSerializer.serializeObject(req.user, strategy),
12 oauthService.findOrGenerateIRCToken(req.user.id),
13 function(serialized, token) {
14 res.send({ token: token, user: serialized });
16 ).catch(next);