feat(salesforce): add authentication

This commit is contained in:
Ali BARIN
2022-11-03 23:08:28 +01:00
parent 7d82ca5d3c
commit ede55a70aa
9 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { instanceUrl, tokenType, accessToken } = $.auth.data;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl as string;
}
if (tokenType && accessToken) {
requestConfig.headers.Authorization = `${tokenType} ${accessToken}`;
}
return requestConfig;
};
export default addAuthHeader;