diff --git a/lib/Adaptor.js b/lib/Adaptor.js index 3f1f28c..7ef7d67 100644 --- a/lib/Adaptor.js +++ b/lib/Adaptor.js @@ -180,7 +180,7 @@ function submitXls(formData, params) { applicationName, hostUrl, username, - password + apiKey } = state.configuration; const json = (0, _languageCommon.expandReferences)(formData)(state); const { @@ -201,7 +201,7 @@ function submitXls(formData, params) { const buffer = _xlsx.default.write(workbook, { type: 'buffer', - bookType: 'xlsx' + bookType: 'xls' }); // xlsx.writeFile(workbook, 'out.xls'); // If needing to write to filesystem @@ -217,11 +217,8 @@ function submitXls(formData, params) { return _languageCommon.http.post({ url, data, - auth: { - username, - password - }, - headers: { ...data.getHeaders() + headers: { ...data.getHeaders(), + Authorization: `ApiKey ${username}:${apiKey}` } })(state).then(response => { return { ...state, diff --git a/src/Adaptor.js b/src/Adaptor.js index 37de566..d0ccc09 100644 --- a/src/Adaptor.js +++ b/src/Adaptor.js @@ -83,12 +83,7 @@ function clientPost({ url, body, username, password }) { */ export function submitXls(formData, params) { return state => { - const { - applicationName, - hostUrl, - username, - password, - } = state.configuration; + const { applicationName, hostUrl, username, apiKey } = state.configuration; const json = expandReferences(formData)(state); const { case_type, search_field, create_new_cases } = params; @@ -105,7 +100,7 @@ export function submitXls(formData, params) { xlsx.utils.book_append_sheet(workbook, worksheet, ws_name); // Generate buffer - const buffer = xlsx.write(workbook, { type: 'buffer', bookType: 'xlsx' }); + const buffer = xlsx.write(workbook, { type: 'buffer', bookType: 'xls' }); // xlsx.writeFile(workbook, 'out.xls'); // If needing to write to filesystem const data = new FormData(); @@ -121,9 +116,9 @@ export function submitXls(formData, params) { .post({ url, data, - auth: { username, password }, headers: { ...data.getHeaders(), + Authorization: `ApiKey ${username}:${apiKey}`, }, })(state) .then(response => {