mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix: Revert "Replace client-oauth2 with an in-repo package" (no-changelog) (#6265)
Revert "feat(core): Replace client-oauth2 with an in-repo package (#6056)"
This reverts commit 77ac953eaf.
This commit is contained in:
committed by
GitHub
parent
8ae2d801d8
commit
b7d30f3eab
@@ -1,5 +1,4 @@
|
||||
import type { ClientOAuth2Options } from '@n8n/client-oauth2';
|
||||
import { ClientOAuth2 } from '@n8n/client-oauth2';
|
||||
import ClientOAuth2 from 'client-oauth2';
|
||||
import Csrf from 'csrf';
|
||||
import express from 'express';
|
||||
import get from 'lodash.get';
|
||||
@@ -120,7 +119,7 @@ oauth2CredentialController.get(
|
||||
};
|
||||
const stateEncodedStr = Buffer.from(JSON.stringify(state)).toString('base64');
|
||||
|
||||
const oAuthOptions: ClientOAuth2Options = {
|
||||
const oAuthOptions: ClientOAuth2.Options = {
|
||||
clientId: get(oauthCredentials, 'clientId') as string,
|
||||
clientSecret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
||||
@@ -251,11 +250,11 @@ oauth2CredentialController.get(
|
||||
return renderCallbackError(res, errorMessage);
|
||||
}
|
||||
|
||||
let options: Partial<ClientOAuth2Options> = {};
|
||||
let options = {};
|
||||
|
||||
const oAuth2Parameters: ClientOAuth2Options = {
|
||||
const oAuth2Parameters = {
|
||||
clientId: get(oauthCredentials, 'clientId') as string,
|
||||
clientSecret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||
clientSecret: get(oauthCredentials, 'clientSecret', '') as string | undefined,
|
||||
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
||||
authorizationUri: get(oauthCredentials, 'authUrl', '') as string,
|
||||
redirectUri: `${getInstanceBaseUrl()}/${restEndpoint}/oauth2-credential/callback`,
|
||||
@@ -269,7 +268,6 @@ oauth2CredentialController.get(
|
||||
client_secret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||
},
|
||||
};
|
||||
// @ts-ignore
|
||||
delete oAuth2Parameters.clientSecret;
|
||||
}
|
||||
|
||||
@@ -280,8 +278,7 @@ oauth2CredentialController.get(
|
||||
const queryParameters = req.originalUrl.split('?').splice(1, 1).join('');
|
||||
|
||||
const oauthToken = await oAuthObj.code.getToken(
|
||||
`${oAuth2Parameters.redirectUri as string}?${queryParameters}`,
|
||||
// @ts-ignore
|
||||
`${oAuth2Parameters.redirectUri}?${queryParameters}`,
|
||||
options,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user