Merge pull request #16000 from drodil/ms_graph_token_url

fix: use graph API target url for access token
This commit is contained in:
Patrik Oldsberg
2023-01-27 11:52:04 +01:00
committed by GitHub
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-msgraph': patch
---
Fix MS Graph provider to use target URL for fetching access token
@@ -53,7 +53,7 @@ describe('MicrosoftGraphClient', () => {
expect(await response.json()).toEqual({ value: 'example' });
expect(tokenCredential.getToken).toHaveBeenCalledTimes(1);
expect(tokenCredential.getToken).toHaveBeenCalledWith(
'https://graph.microsoft.com/.default',
'https://example.com/.default',
);
});
@@ -214,7 +214,7 @@ export class MicrosoftGraphClient {
): Promise<Response> {
// Make sure that we always have a valid access token (might be cached)
const token = await this.tokenCredential.getToken(
'https://graph.microsoft.com/.default',
`${this.baseUrl}/.default`,
);
if (!token) {