mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Fix oauth server module
This commit is contained in:
parent
b224ddd88b
commit
bfcef50db9
5 changed files with 11 additions and 24 deletions
|
@ -23,6 +23,7 @@ function getClient (clientId: string, clientSecret: string) {
|
|||
function getRefreshToken (refreshToken: string) {
|
||||
logger.debug('Getting RefreshToken (refreshToken: ' + refreshToken + ').')
|
||||
|
||||
|
||||
return OAuthTokenModel.getByRefreshTokenAndPopulateClient(refreshToken)
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,10 @@ async function getUser (usernameOrEmail: string, password: string) {
|
|||
|
||||
async function revokeToken (tokenInfo: TokenInfo) {
|
||||
const token = await OAuthTokenModel.getByRefreshTokenAndPopulateUser(tokenInfo.refreshToken)
|
||||
if (token) token.destroy()
|
||||
if (token) {
|
||||
token.destroy()
|
||||
.catch(err => logger.error('Cannot destroy token when revoking token.', { err }))
|
||||
}
|
||||
|
||||
/*
|
||||
* Thanks to https://github.com/manjeshpv/node-oauth2-server-implementation/blob/master/components/oauth/mongo-models.js
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue