From 535dea90a4d114cc977e8da195ac1f682793acc4 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 23 Mar 2023 12:27:59 +0100 Subject: [PATCH] Add grant_type to the env.-Parameters Add grant_type to the env.-Parameters so that it is not hard-coded to "password" anymore --- src/utils/http-client.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/http-client.js b/src/utils/http-client.js index b185540..8d8317a 100644 --- a/src/utils/http-client.js +++ b/src/utils/http-client.js @@ -12,9 +12,12 @@ const { CLIENT_SECRET: client_secret, API_USERNAME: username, API_PASSWORD: password, - AIR_KEY: airKey + AIR_KEY: airKey, + GRANT_TYPE: _grant_type } = process.env; -const getOwnerCredentials = oauth.client(axios.create(), { url, grant_type: 'password', client_id, client_secret, username, password }); + +const grant_type = _grant_type || 'password'; +const getOwnerCredentials = oauth.client(axios.create(), { url, grant_type, client_id, client_secret, username, password }); const { BASE_URL, BASE_SITE_ID, OCC_PATH, CMS_PATH } = process.env; const client = axios.create({ baseURL: BASE_URL });