mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: migrate away from querystring (#4180)
refactor: migrate away from querystring
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
import { resolve as pathResolve } from 'path';
|
||||
import querystring from 'querystring';
|
||||
|
||||
import { Db, ICredentialsDb, ResponseHelper } from '..';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '../constants';
|
||||
@@ -141,11 +140,14 @@ oauth2CredentialController.get(
|
||||
|
||||
// if scope uses comma, change it as the library always return then with spaces
|
||||
if ((get(oauthCredentials, 'scope') as string).includes(',')) {
|
||||
const data = querystring.parse(returnUri.split('?')[1]);
|
||||
data.scope = get(oauthCredentials, 'scope') as string;
|
||||
returnUri = `${get(oauthCredentials, 'authUrl', '') as string}?${querystring.stringify(
|
||||
data,
|
||||
)}`;
|
||||
// const data = new URLSearchParams(returnUri.split('?')[1]);
|
||||
// data.set('scope', get(oauthCredentials, 'scope') as string);
|
||||
// returnUri = `${get(oauthCredentials, 'authUrl', '') as string}?${data.toString()}`;
|
||||
|
||||
const data = returnUri.split('?')[1];
|
||||
const scope = get(oauthCredentials, 'scope') as string;
|
||||
const percentEncoded = [data, `scope=${encodeURIComponent(scope)}`].join('&');
|
||||
returnUri = `${get(oauthCredentials, 'authUrl', '') as string}?${percentEncoded}`;
|
||||
}
|
||||
|
||||
if (authQueryParameters) {
|
||||
|
||||
Reference in New Issue
Block a user