diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/oauth-model.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index f159ad6a9..272e90f3a 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts | |||
@@ -23,6 +23,7 @@ function getClient (clientId: string, clientSecret: string) { | |||
23 | function getRefreshToken (refreshToken: string) { | 23 | function getRefreshToken (refreshToken: string) { |
24 | logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').') | 24 | logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').') |
25 | 25 | ||
26 | |||
26 | return OAuthTokenModel.getByRefreshTokenAndPopulateClient(refreshToken) | 27 | return OAuthTokenModel.getByRefreshTokenAndPopulateClient(refreshToken) |
27 | } | 28 | } |
28 | 29 | ||
@@ -42,7 +43,10 @@ async function getUser (usernameOrEmail: string, password: string) { | |||
42 | 43 | ||
43 | async function revokeToken (tokenInfo: TokenInfo) { | 44 | async function revokeToken (tokenInfo: TokenInfo) { |
44 | const token = await OAuthTokenModel.getByRefreshTokenAndPopulateUser(tokenInfo.refreshToken) | 45 | const token = await OAuthTokenModel.getByRefreshTokenAndPopulateUser(tokenInfo.refreshToken) |
45 | if (token) token.destroy() | 46 | if (token) { |
47 | token.destroy() | ||
48 | .catch(err => logger.error('Cannot destroy token when revoking token.', { err })) | ||
49 | } | ||
46 | 50 | ||
47 | /* | 51 | /* |
48 | * Thanks to https://github.com/manjeshpv/node-oauth2-server-implementation/blob/master/components/oauth/mongo-models.js | 52 | * Thanks to https://github.com/manjeshpv/node-oauth2-server-implementation/blob/master/components/oauth/mongo-models.js |