This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Sign out -> delete all access and refresh tokens | |
module.exports.signOut = function(req, res){ | |
//Delete refresh tokens | |
req.user.getRefreshTokens(function(err,refreshTokens){ | |
refreshTokens.each(deleteToken, function (err) { | |
if(err) { | |
res.status(400).send({ message: 'Oops! There was an error: ' + err.userMessage}); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create api key | |
module.exports.createApiKey = function(req, res) { | |
req.user.createApiKey(function(err, apiKey){ | |
if(err) return helpers.handleError(err,res); | |
return res.status(201).send({status: 'success', code: 'api_key_created', message: 'Api key created.', data: apiKey}); | |
}); | |
} |
NewerOlder