fix(basic.gblib): Fixed get token from BASIC methods.

This commit is contained in:
Rodrigo Rodriguez 2021-01-12 18:33:21 -03:00
parent b77a4b099b
commit 6399c2dd0f
4 changed files with 19 additions and 10 deletions

View file

@ -73,3 +73,10 @@ ALTER TABLE dbo.GuaribasConversation ADD
instanceId int,
feedback nvarchar(512) NULL
GO
ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [translatorendpoint]
GO
ALTER TABLE dbo.GuaribasInstance ADD
translatorEndpoint nvarchar(128) NULL
GO

View file

@ -261,6 +261,7 @@ export class GBAdminService implements IGBAdminService {
const refreshToken = await this.getValue(instanceId, 'refreshToken');
const resource = 'https://graph.microsoft.com';
const authenticationContext = new AuthenticationContext(authorizationUrl);
authenticationContext.acquireTokenWithRefreshToken(
refreshToken,
instance.marketplaceId,

View file

@ -81,7 +81,7 @@ export class SystemKeywords {
}
});
const baseUrl = `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}`;
return [client, baseUrl];
return [baseUrl, client];
}
/**
@ -259,6 +259,7 @@ export class SystemKeywords {
let document = await this.internalGetDocument(client, baseUrl, path, file);
// Creates workbook session that will be discarded.
let sheets = await client
.api(`${baseUrl}/drive/items/${document.id}/workbook/worksheets`)
.get();

View file

@ -371,9 +371,9 @@ export class GBDeployer implements IGBDeployer {
const libraryId = process.env.STORAGE_LIBRARY;
GBLog.info(`Connecting to Config.xslx (siteId: ${siteId}, libraryId: ${libraryId})...`);
// Connects to MSFT storage.
const token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
const client = MicrosoftGraph.Client.init({
authProvider: done => {
@ -381,19 +381,19 @@ export class GBDeployer implements IGBDeployer {
}
});
// Retrives all files in .bot folder.
// Retrieves all files in .bot folder.
const botId = min.instance.botId;
const path = `/${botId}.gbai/${botId}.gbot`;
GBLog.info(`Loading .gbot from ${path}.`);
let url = `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`;
GBLog.info(`Loading .gbot from Excel: ${url}`);
const res = await client
.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:${path}:/children`)
.get();
.api(url)
.get();
// Finds Config.xlsx.
const document = res.value.filter(m => {
return m.name === 'Config.xlsx';
});