X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fauth%2Foauth.ts;h=fa18873158fca4f174c644301b2b5bbcc8cb5e25;hb=a49407524fc1212299a41d7c5330f27b36112167;hp=dc0022852dbc10100653a3f919adfcf273f38e4f;hpb=c55e3d7227fe1453869e309025996b9d75256d5d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/auth/oauth.ts b/server/lib/auth/oauth.ts index dc0022852..fa1887315 100644 --- a/server/lib/auth/oauth.ts +++ b/server/lib/auth/oauth.ts @@ -1,5 +1,5 @@ import express from 'express' -import { +import OAuth2Server, { InvalidClientError, InvalidGrantError, InvalidRequestError, @@ -7,10 +7,10 @@ import { Response, UnauthorizedClientError, UnsupportedGrantTypeError -} from 'oauth2-server' -import { sha1 } from '@shared/core-utils/common/crypto' +} from '@node-oauth/oauth2-server' import { randomBytesPromise } from '@server/helpers/core-utils' import { MOAuthClient } from '@server/types/models' +import { sha1 } from '@shared/extra-utils' import { OAUTH_LIFETIME } from '../../initializers/constants' import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model' @@ -19,8 +19,7 @@ import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToke * Reimplement some functions of OAuth2Server to inject external auth methods * */ - -const oAuthServer = new (require('oauth2-server'))({ +const oAuthServer = new OAuth2Server({ accessTokenLifetime: OAUTH_LIFETIME.ACCESS_TOKEN, refreshTokenLifetime: OAUTH_LIFETIME.REFRESH_TOKEN,