Skip to content

Commit 27fc5f6

Browse files
Added initializing MSALAuthProvider with userAgentApplication
1 parent 22d1bad commit 27fc5f6

File tree

5 files changed

+779
-784
lines changed

5 files changed

+779
-784
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ npm install msal@<version>
7878
```
7979

8080
```typescript
81+
import { UserAgentApplication } from "msal";
82+
8183
import { MSALAuthenticationProvider } from "./node_modules/@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProvider";
8284

8385
const clientId = "your_client_id"; // Client Id of the registered application
84-
const graphScopes = ["user.read", "mail.send"]; // An array of graph scopes
86+
const callback = (errorDesc, token, error, tokenType) => {};
87+
// An Optional options for initializing the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics#configuration-options
8588
const options = {
86-
// An Optional options for initializing the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics#configuration-options
8789
redirectUri: "Your redirect URI",
8890
};
89-
const authProvider = new MSALAuthenticationProvider(clientId, scopes, options);
91+
const graphScopes = ["user.read", "mail.send"]; // An array of graph scopes
92+
93+
// Initialize the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics#initialization-of-msal
94+
const userAgentApplication = new UserAgentApplication(clientId, undefined, callback, options);
95+
const authProvider = new MSALAuthenticationProvider(userAgentApplication, scopes);
9096
```
9197

9298
User can integrate own preferred authentication library by implementing `IAuthenticationProvider` interface. Refer implementing [Custom Authentication Provider](./docs/CustomAuthenticationProvider.md).

0 commit comments

Comments
 (0)