}
function revokeToken (token) {
- return OAuthToken.getByRefreshToken(token.refreshToken).then(function (tokenDB) {
+ return OAuthToken.getByRefreshTokenAndPopulateUser(token.refreshToken).then(function (tokenDB) {
if (tokenDB) tokenDB.remove()
/*
*/
const expiredToken = tokenDB
expiredToken.refreshTokenExpiresAt = new Date('2015-05-28T06:59:53.000Z')
+
return expiredToken
})
}
OAuthTokenSchema.statics = {
getByRefreshTokenAndPopulateClient,
getByTokenAndPopulateUser,
- getByRefreshToken,
+ getByRefreshTokenAndPopulateUser,
removeByUserId
}
return this.findOne({ accessToken: bearerToken }).populate('user').exec()
}
-function getByRefreshToken (refreshToken) {
- return this.findOne({ refreshToken: refreshToken }).exec()
+function getByRefreshTokenAndPopulateUser (refreshToken) {
+ return this.findOne({ refreshToken: refreshToken }).populate('user').exec()
}
function removeByUserId (userId, callback) {