]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/auth/oauth.ts
Prevent invalid watch sections
[github/Chocobozzz/PeerTube.git] / server / lib / auth / oauth.ts
index a97681c86b76e30bea5af1b668ae838754015d31..fa18873158fca4f174c644301b2b5bbcc8cb5e25 100644 (file)
@@ -1,5 +1,5 @@
-import * as express from 'express'
-import {
+import express from 'express'
+import OAuth2Server, {
   InvalidClientError,
   InvalidGrantError,
   InvalidRequestError,
@@ -7,9 +7,10 @@ import {
   Response,
   UnauthorizedClientError,
   UnsupportedGrantTypeError
-} from 'oauth2-server'
-import { randomBytesPromise, sha1 } from '@server/helpers/core-utils'
+} 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'
 
@@ -18,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,