From 03586868ecf108a391c959d76f295888c65244c9 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Thu, 28 Dec 2023 08:21:16 -0300 Subject: [PATCH] fix(core.gbapp): #387 adding /setupSecurity multiple tokens. Refresh token fix. @othonlima @christopherdecastilho. --- packages/basic.gblib/services/GBVMService.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/basic.gblib/services/GBVMService.ts b/packages/basic.gblib/services/GBVMService.ts index da40d4e3..d50e19dd 100644 --- a/packages/basic.gblib/services/GBVMService.ts +++ b/packages/basic.gblib/services/GBVMService.ts @@ -605,8 +605,8 @@ export class GBVMService extends GBService { const ensureTokens = async (firstTime) => { const tokens = this.tokens ? this.tokens.split(',') : []; - for(i in tokens) { - const tokenName = tokens[i]; + for(tokenIndexer in tokens) { + const tokenName = tokens[tokenIndexer]; // Auto update Bearar authentication for the first token. @@ -622,7 +622,8 @@ export class GBVMService extends GBService { global[tokenName] = token; global[tokenName + "_expiresOn"]= expiresOn; } - if (i == 0) { + + if (tokenIndexer == 0) { headers['Authorization'] = 'Bearer ' + global[tokenName]; } }