mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
Use instance URL for OAuth callback (#3560)
Use editor URL instead of webhook url for oauth connections
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
|||||||
import { resolve as pathResolve } from 'path';
|
import { resolve as pathResolve } from 'path';
|
||||||
import querystring from 'querystring';
|
import querystring from 'querystring';
|
||||||
|
|
||||||
import { Db, ICredentialsDb, ResponseHelper, WebhookHelpers } from '..';
|
import { Db, ICredentialsDb, ResponseHelper } from '..';
|
||||||
import { RESPONSE_ERROR_MESSAGES } from '../constants';
|
import { RESPONSE_ERROR_MESSAGES } from '../constants';
|
||||||
import {
|
import {
|
||||||
CredentialsHelper,
|
CredentialsHelper,
|
||||||
@@ -29,6 +29,7 @@ import { getLogger } from '../Logger';
|
|||||||
import { OAuthRequest } from '../requests';
|
import { OAuthRequest } from '../requests';
|
||||||
import { externalHooks } from '../Server';
|
import { externalHooks } from '../Server';
|
||||||
import config from '../../config';
|
import config from '../../config';
|
||||||
|
import { getInstanceBaseUrl } from '../UserManagement/UserManagementHelper';
|
||||||
|
|
||||||
export const oauth2CredentialController = express.Router();
|
export const oauth2CredentialController = express.Router();
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ oauth2CredentialController.get(
|
|||||||
clientSecret: get(oauthCredentials, 'clientSecret', '') as string,
|
clientSecret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||||
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
||||||
authorizationUri: get(oauthCredentials, 'authUrl', '') as string,
|
authorizationUri: get(oauthCredentials, 'authUrl', '') as string,
|
||||||
redirectUri: `${WebhookHelpers.getWebhookBaseUrl()}${restEndpoint}/oauth2-credential/callback`,
|
redirectUri: `${getInstanceBaseUrl()}${restEndpoint}/oauth2-credential/callback`,
|
||||||
scopes: split(get(oauthCredentials, 'scope', 'openid,') as string, ','),
|
scopes: split(get(oauthCredentials, 'scope', 'openid,') as string, ','),
|
||||||
state: stateEncodedStr,
|
state: stateEncodedStr,
|
||||||
};
|
};
|
||||||
@@ -265,7 +266,7 @@ oauth2CredentialController.get(
|
|||||||
clientSecret: get(oauthCredentials, 'clientSecret', '') as string | undefined,
|
clientSecret: get(oauthCredentials, 'clientSecret', '') as string | undefined,
|
||||||
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
accessTokenUri: get(oauthCredentials, 'accessTokenUrl', '') as string,
|
||||||
authorizationUri: get(oauthCredentials, 'authUrl', '') as string,
|
authorizationUri: get(oauthCredentials, 'authUrl', '') as string,
|
||||||
redirectUri: `${WebhookHelpers.getWebhookBaseUrl()}${restEndpoint}/oauth2-credential/callback`,
|
redirectUri: `${getInstanceBaseUrl()}${restEndpoint}/oauth2-credential/callback`,
|
||||||
scopes: split(get(oauthCredentials, 'scope', 'openid,') as string, ','),
|
scopes: split(get(oauthCredentials, 'scope', 'openid,') as string, ','),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user