Skip to content

Commit

Permalink
fix(basic.gblib): Fixed get token from BASIC methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jan 12, 2021
1 parent b77a4b0 commit 6399c2d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
7 changes: 7 additions & 0 deletions DATABASE-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions packages/admin.gbapp/services/GBAdminService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/basic.gblib/services/SystemKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

/**
Expand Down Expand Up @@ -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();
Expand Down
18 changes: 9 additions & 9 deletions packages/core.gbapp/services/GBDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,29 +371,29 @@ 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 => {
done(null, token);
}
});


// 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';
});
Expand Down

0 comments on commit 6399c2d

Please sign in to comment.