import express from 'express'
-import {
+import OAuth2Server, {
InvalidClientError,
InvalidGrantError,
InvalidRequestError,
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'
* 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,