in src/lib/salesforceAuthenticator.ts [12:26]
export async function authenticate(config: Config) {
console.log('Authenticating with Salesforce.');
const url = `https://${config.salesforce.api.salesforceUrl}/services/oauth2/token`;
const auth = {
grant_type: 'password',
client_id: config.salesforce.api.consumer_key,
client_secret: config.salesforce.api.consumer_secret,
username: config.salesforce.api.username,
password: `${config.salesforce.api.password}${config.salesforce.api.token}`,
};
const result = await rp.post(url, { form: auth });
const j = JSON.parse(result);
return new Salesforce(j.instance_url, j.access_token);
}