diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-28 10:56:09 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-28 10:56:09 +0200 |
commit | bfcef50db9c1c1d34ea550ea156c52cb327e160e (patch) | |
tree | e3e86ac9d0b2c46d78ba0bcc473a0fc47ef9ce4e /server/lib | |
parent | b224ddd88b767b9a6402e3648993b4f2707057ef (diff) | |
download | PeerTube-bfcef50db9c1c1d34ea550ea156c52cb327e160e.tar.gz PeerTube-bfcef50db9c1c1d34ea550ea156c52cb327e160e.tar.zst PeerTube-bfcef50db9c1c1d34ea550ea156c52cb327e160e.zip |
Fix oauth server module
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 |