diff --git a/package-lock.json b/package-lock.json index 985a8d599..b3db57cf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2324,18 +2324,21 @@ "integrity": "sha512-vKbuG3Mcbc4kkNAcIE13aIv5KoI2g+tHFFIZnFhtUilpYHc0VsMd4Fw7Jz81A8AB7L3wWu3OZB2CNiRnr1a3ew==" }, "@microsoft/microsoft-graph-client": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-client/-/microsoft-graph-client-2.1.0.tgz", - "integrity": "sha512-2OjZjz9ink5cXdY3107ZaLe9E32muYhQJy7e0II9cPyBeOXnuJwySzXC4Fv3UhPO2CjVvysiHIQo5gfszIOJHw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@microsoft/microsoft-graph-client/-/microsoft-graph-client-3.0.2.tgz", + "integrity": "sha512-eYDiApYmiGsm1s1jfAa/rhB2xQCsX4pWt0vCTd1LZmiApMQfT/c0hXj2hvpuGz5GrcLdugbu05xB79rIV57Pjw==", "requires": { - "@babel/runtime": "^7.4.4", - "tslib": "^1.9.3" + "@babel/runtime": "^7.12.5", + "tslib": "^2.2.0" }, "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "@babel/runtime": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.7.tgz", + "integrity": "sha512-L6rvG9GDxaLgFjg41K+5Yv9OMrU98sWe+Ykmc6FDJW/+vYZMhdOMKkISgzptMaERHvS2Y2lw9MDRm2gHhlQQoA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } } } }, diff --git a/package.json b/package.json index 984da1a2b..b97391a8e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@fluentui/react": "8.43.0", "@microsoft/applicationinsights-react-js": "2.3.1", "@microsoft/applicationinsights-web": "2.7.1", - "@microsoft/microsoft-graph-client": "2.1.0", + "@microsoft/microsoft-graph-client": "3.0.2", "@monaco-editor/react": "4.3.1", "@ms-ofb/officebrowserfeedbacknpm": "file:packages/officebrowserfeedbacknpm-1.6.6.tgz", "adaptivecards": "1.2.3", @@ -124,4 +124,4 @@ "reportFile": "test-report.xml", "indent": 4 } -} +} \ No newline at end of file diff --git a/src/app/services/actions/query-action-creator-util.ts b/src/app/services/actions/query-action-creator-util.ts index 533116bef..90d129a39 100644 --- a/src/app/services/actions/query-action-creator-util.ts +++ b/src/app/services/actions/query-action-creator-util.ts @@ -1,12 +1,14 @@ +import { InteractionType } from '@azure/msal-browser'; import { AuthenticationHandlerOptions, GraphRequest, ResponseType } from '@microsoft/microsoft-graph-client'; import { - MSALAuthenticationProviderOptions -} from '@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProviderOptions'; + AuthCodeMSALBrowserAuthenticationProviderOptions +} from '@microsoft/microsoft-graph-client/authProviders/authCodeMsalBrowser'; +import { authenticationWrapper } from '../../../modules/authentication'; import { IAction } from '../../../types/action'; import { ContentType } from '../../../types/enums'; import { IQuery } from '../../../types/query-runner'; @@ -95,11 +97,15 @@ function createAuthenticatedRequest( }); } - const msalAuthOptions = new MSALAuthenticationProviderOptions(scopes); + const msalAuthOptions:AuthCodeMSALBrowserAuthenticationProviderOptions = { + account: authenticationWrapper.getAccount()!, + interactionType: InteractionType.Popup , + scopes + } const middlewareOptions = new AuthenticationHandlerOptions( authProvider, msalAuthOptions - ); + ) const graphRequest = GraphClient.getInstance() .api(encodeHashCharacters(query)) .middlewareOptions([middlewareOptions]) diff --git a/src/app/services/graph-client/graph-client.ts b/src/app/services/graph-client/graph-client.ts index 18f87dc68..21640c984 100644 --- a/src/app/services/graph-client/graph-client.ts +++ b/src/app/services/graph-client/graph-client.ts @@ -1,6 +1,6 @@ import { Client } from '@microsoft/microsoft-graph-client'; import 'isomorphic-fetch'; -import { authProvider } from './'; +import { authProvider } from '.'; export class GraphClient { private static client: Client; diff --git a/src/app/services/graph-client/index.ts b/src/app/services/graph-client/index.ts index bc3d2312d..befe8e4b5 100644 --- a/src/app/services/graph-client/index.ts +++ b/src/app/services/graph-client/index.ts @@ -1,4 +1,4 @@ import { GraphAuthenticationProvider } from './GraphAuthenticationProvider'; export { GraphClient } from './graph-client'; -export const authProvider = new GraphAuthenticationProvider(); +export const authProvider = new GraphAuthenticationProvider(); \ No newline at end of file diff --git a/src/modules/authentication/AuthenticationWrapper.ts b/src/modules/authentication/AuthenticationWrapper.ts index 9e5b98e6d..88743959e 100644 --- a/src/modules/authentication/AuthenticationWrapper.ts +++ b/src/modules/authentication/AuthenticationWrapper.ts @@ -79,7 +79,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper { return undefined; } - const allAccounts = msalApplication.getAllAccounts(); + const allAccounts: AccountInfo[] = msalApplication.getAllAccounts(); if (!allAccounts || allAccounts.length === 0) { return undefined; }