From bb1d88b64706e83a9f491030ca3459a9899a3589 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 20 Dec 2022 10:50:29 +0100 Subject: [PATCH] Logging changes --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8abc4fe..50ee720 100644 --- a/index.js +++ b/index.js @@ -47,18 +47,20 @@ async function getClientToken() { headers: { "Content-Type": "application/x-www-form-urlencoded", }, - body: `grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}&scope=role:app catalog:read organization:read`, + body: `grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}&scope=role:app catalog:read supply:read organization:read network:read`, }); const tokenResponse = await tokenRequest.json(); + console.log("Token response: ", tokenResponse); + const accessToken = tokenResponse.access_token; let now = moment().format("YYYY-MM-DD HH:mm:ss"); let tokenExpirationDate = moment(now) .add(tokenResponse.expires_in, "s") .format("YYYY-MM-DD HH:mm:ss"); - + updateClientConfig( clientId, clientSecret, @@ -80,6 +82,8 @@ async function updateClientConfig( tokenExpirationDate ) { try { + + console.log("Updating the client config with the new token..."); await models.clientConfig.update( { clientId: clientId,