mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add sandbox option to Salesforce OAuth2 credentials (#1979)
* ⚡ Add environment dropdown to OAuth2 creds * ⚡ Add sandbox URL to OAuth2 call * ⏪ Revert options change * ⚡ Set OAuth2 URLs with expressions * ⚡ Extract instance URL from credentials
This commit is contained in:
@@ -40,9 +40,8 @@ export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSin
|
||||
} else {
|
||||
// https://help.salesforce.com/articleView?id=remoteaccess_oauth_web_server_flow.htm&type=5
|
||||
const credentialsType = 'salesforceOAuth2Api';
|
||||
const credentials = this.getCredentials(credentialsType);
|
||||
const subdomain = ((credentials!.accessTokenUrl as string).match(/https:\/\/(.+).salesforce\.com/) || [])[1];
|
||||
const options = getOptions.call(this, method, (uri || endpoint), body, qs, `https://${subdomain}.salesforce.com`);
|
||||
const credentials = this.getCredentials(credentialsType) as { oauthTokenData: { instance_url: string } };
|
||||
const options = getOptions.call(this, method, (uri || endpoint), body, qs, credentials.oauthTokenData.instance_url);
|
||||
Logger.debug(`Authentication for "Salesforce" node is using "OAuth2". Invoking URI ${options.uri}`);
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth2.call(this, credentialsType, options);
|
||||
|
||||
Reference in New Issue
Block a user