@azure/msal-react 2.0.0-alpha.1 → 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +144 -144
  3. package/dist/MsalContext.d.ts +10 -10
  4. package/dist/MsalContext.js +16 -16
  5. package/dist/MsalProvider.d.ts +9 -9
  6. package/dist/MsalProvider.js +131 -131
  7. package/dist/components/AuthenticatedTemplate.d.ts +8 -8
  8. package/dist/components/AuthenticatedTemplate.js +23 -23
  9. package/dist/components/MsalAuthenticationTemplate.d.ts +16 -16
  10. package/dist/components/MsalAuthenticationTemplate.js +33 -33
  11. package/dist/components/UnauthenticatedTemplate.d.ts +8 -8
  12. package/dist/components/UnauthenticatedTemplate.js +25 -25
  13. package/dist/components/withMsal.d.ts +11 -11
  14. package/dist/components/withMsal.js +17 -17
  15. package/dist/error/ReactAuthError.d.ts +16 -16
  16. package/dist/error/ReactAuthError.js +27 -27
  17. package/dist/hooks/useAccount.d.ts +7 -7
  18. package/dist/hooks/useAccount.js +33 -33
  19. package/dist/hooks/useIsAuthenticated.d.ts +6 -6
  20. package/dist/hooks/useIsAuthenticated.js +30 -30
  21. package/dist/hooks/useMsal.d.ts +5 -5
  22. package/dist/hooks/useMsal.js +8 -8
  23. package/dist/hooks/useMsalAuthentication.d.ts +18 -18
  24. package/dist/hooks/useMsalAuthentication.js +184 -184
  25. package/dist/index.d.ts +23 -23
  26. package/dist/index.js +1 -1
  27. package/dist/packageMetadata.d.ts +2 -2
  28. package/dist/packageMetadata.js +4 -4
  29. package/dist/types/AccountIdentifiers.d.ts +2 -2
  30. package/dist/utils/utilities.d.ts +17 -17
  31. package/dist/utils/utilities.js +60 -60
  32. package/package.json +65 -65
  33. package/dist/msal-react.cjs.development.js +0 -685
  34. package/dist/msal-react.cjs.development.js.map +0 -1
  35. package/dist/msal-react.cjs.production.min.js +0 -2
  36. package/dist/msal-react.cjs.production.min.js.map +0 -1
  37. package/dist/msal-react.esm.js +0 -667
  38. package/dist/msal-react.esm.js.map +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md CHANGED
@@ -1,144 +1,144 @@
1
- # Microsoft Authentication Library for React (msal-react)
2
-
3
- [![npm version](https://img.shields.io/npm/v/@azure/msal-react.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-react/)
4
- [![npm version](https://img.shields.io/npm/dm/@azure/msal-react.svg)](https://nodei.co/npm/@azure/msal-react/)
5
- [![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-react)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
6
-
7
- | <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-react" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_react.html" target="_blank">Library Reference</a> | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples" target="blank">Samples</a>
8
- |--- | --- | --- | --- |
9
-
10
- 1. [About](#about)
11
- 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/FAQ.md)
12
- 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/CHANGELOG.md)
13
- 1. [Prerequisites](#prerequisites)
14
- 1. [Installation](#installation)
15
- 1. [Build and Test](#build-and-test)
16
- 1. [Usage](#usage)
17
- - [Getting Started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md)
18
- - [Msal Basics](#msal-basics)
19
- - [Advanced Topics](#advanced-topics)
20
- - [MSAL React Specific Concepts](#msal-react-specific-concepts)
21
- 1. [Samples](#samples)
22
- 1. [Security Reporting](#security-reporting)
23
- 1. [License](#license)
24
- 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
25
-
26
- ## About
27
-
28
- The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
29
-
30
- The `@azure/msal-react` package described by the code in this folder uses the [`@azure/msal-browser` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) as a peer dependency to enable authentication in Javascript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section in the [@azure/msal-browser readme](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/README.md#implicit-flow-vs-authorization-code-flow-with-pkce).
31
-
32
- ## Prerequisites
33
-
34
- - `@azure/msal-react` is meant to be used in [Single-Page Application scenarios](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-overview).
35
-
36
- - Before using `@azure/msal-react` you will need to [register a Single Page Application in Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration) to get a valid `clientId` for configuration, and to register the routes that your app will accept redirect traffic on.
37
-
38
- ## Installation
39
-
40
- The MSAL React package is available on NPM.
41
-
42
- ```sh
43
- npm install react react-dom
44
- npm install @azure/msal-react @azure/msal-browser
45
- ```
46
-
47
- ## Build and Test
48
-
49
- See the [`contributing.md`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/contributing.md) file for more information.
50
-
51
- ### Building the package locally
52
-
53
- To build the `@azure/msal-react` library, you can do the following:
54
-
55
- ```bash
56
- // Install dev dependencies from root of repo
57
- npm install
58
- // Change to the msal-react package directory
59
- cd lib/msal-react/
60
- // To run build only for react package
61
- npm run build
62
- ```
63
-
64
- To build both the `@azure/msal-react` library and `@azure/msal-browser` libraries, you can do the following:
65
-
66
- ```bash
67
- // Install dev dependencies from root of repo
68
- npm install
69
- // Change to the msal-react package directory
70
- cd lib/msal-react/
71
- // To run build for react and browser packages
72
- npm run build:all
73
- ```
74
-
75
- ### Running Tests
76
-
77
- `@azure/msal-react` uses [jest](https://jestjs.io/) to run unit tests and coverage.
78
-
79
- ```bash
80
- // To run tests
81
- npm test
82
- // To run tests with code coverage
83
- npm run test:coverage
84
- ```
85
-
86
- ## Usage
87
-
88
- For help getting started with `@azure/msal-react` please see our [getting started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md) doc.
89
-
90
- Migrating from [react-aad-msal](https://www.npmjs.com/package/react-aad-msal)? Check out our [migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/migration-guide.md).
91
-
92
- ### MSAL Basics
93
-
94
- Since `@azure/msal-react` is a wrapper around `@azure/msal-browser` many docs from the `msal-browser` repo are relevant here as well. For concepts specific to `@azure/msal-react` please see [below](#msal-react-specific-concepts)
95
-
96
- 1. [Initialization](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md)
97
- 1. [Acquiring and using an access token](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/acquire-token.md)
98
- 1. [Managing token lifetimes](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/token-lifetimes.md)
99
- 1. [Managing Accounts](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Accounts.md)
100
- 1. [Logging out](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/logout.md)
101
-
102
- ### Advanced Topics
103
-
104
- - [Configuration Options](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md)
105
- - [Request and Response Details](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/request-response-object.md)
106
- - [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/events.md)
107
- - [Cache Storage](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/caching.md)
108
- - [Performance Enhancements](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/performance.md)
109
-
110
- ### MSAL React Specific Concepts
111
-
112
- 1. [Hooks](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/hooks.md)
113
- 1. [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/events.md)
114
- 1. [Class Components](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/class-components.md)
115
- 1. [Performance](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/performance.md)
116
-
117
- ## Samples
118
-
119
- Our [samples directory](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples) contains several example apps you can spin up to see how this library can be used in different contexts.
120
-
121
- - [Create React App (JS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/react-router-sample)
122
- - [Create React App (TS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/typescript-sample)
123
- - [Next.js Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/nextjs-sample)
124
- - [Gatsby Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/gatsby-sample)
125
- - [B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/b2c-sample)
126
-
127
- More advanced samples backed with a tutorial can be found in the [Azure Samples](https://github.com/Azure-Samples) space on GitHub:
128
-
129
- - [React SPA calling Express.js web API](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/1-call-api)
130
- - [React SPA calling Express.js web API using App Roles and RBAC](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl/1-call-api-roles)
131
- - [React SPA calling Microsoft Graph via Express.js web API using on-behalf-of flow](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/6-AdvancedScenarios/1-call-api-obo)
132
- - [Deployment tutorial for Azure Static Web Apps](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/4-Deployment/2-deploy-static)
133
-
134
- ## Security Reporting
135
-
136
- If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.
137
-
138
- ## License
139
-
140
- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
141
-
142
- ## We Value and Adhere to the Microsoft Open Source Code of Conduct
143
-
144
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
1
+ # Microsoft Authentication Library for React (msal-react)
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@azure/msal-react.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-react/)
4
+ [![npm version](https://img.shields.io/npm/dm/@azure/msal-react.svg)](https://nodei.co/npm/@azure/msal-react/)
5
+ [![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-react)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
6
+
7
+ | <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-react" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_react.html" target="_blank">Library Reference</a> | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples" target="blank">Samples</a>
8
+ |--- | --- | --- | --- |
9
+
10
+ 1. [About](#about)
11
+ 1. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/FAQ.md)
12
+ 1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/CHANGELOG.md)
13
+ 1. [Prerequisites](#prerequisites)
14
+ 1. [Installation](#installation)
15
+ 1. [Build and Test](#build-and-test)
16
+ 1. [Usage](#usage)
17
+ - [Getting Started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md)
18
+ - [Msal Basics](#msal-basics)
19
+ - [Advanced Topics](#advanced-topics)
20
+ - [MSAL React Specific Concepts](#msal-react-specific-concepts)
21
+ 1. [Samples](#samples)
22
+ 1. [Security Reporting](#security-reporting)
23
+ 1. [License](#license)
24
+ 1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
25
+
26
+ ## About
27
+
28
+ The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
29
+
30
+ The `@azure/msal-react` package described by the code in this folder uses the [`@azure/msal-browser` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) as a peer dependency to enable authentication in Javascript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section in the [@azure/msal-browser readme](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/README.md#implicit-flow-vs-authorization-code-flow-with-pkce).
31
+
32
+ ## Prerequisites
33
+
34
+ - `@azure/msal-react` is meant to be used in [Single-Page Application scenarios](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-overview).
35
+
36
+ - Before using `@azure/msal-react` you will need to [register a Single Page Application in Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration) to get a valid `clientId` for configuration, and to register the routes that your app will accept redirect traffic on.
37
+
38
+ ## Installation
39
+
40
+ The MSAL React package is available on NPM.
41
+
42
+ ```sh
43
+ npm install react react-dom
44
+ npm install @azure/msal-react @azure/msal-browser
45
+ ```
46
+
47
+ ## Build and Test
48
+
49
+ See the [`contributing.md`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/contributing.md) file for more information.
50
+
51
+ ### Building the package locally
52
+
53
+ To build the `@azure/msal-react` library, you can do the following:
54
+
55
+ ```bash
56
+ // Install dev dependencies from root of repo
57
+ npm install
58
+ // Change to the msal-react package directory
59
+ cd lib/msal-react/
60
+ // To run build only for react package
61
+ npm run build
62
+ ```
63
+
64
+ To build both the `@azure/msal-react` library and `@azure/msal-browser` libraries, you can do the following:
65
+
66
+ ```bash
67
+ // Install dev dependencies from root of repo
68
+ npm install
69
+ // Change to the msal-react package directory
70
+ cd lib/msal-react/
71
+ // To run build for react and browser packages
72
+ npm run build:all
73
+ ```
74
+
75
+ ### Running Tests
76
+
77
+ `@azure/msal-react` uses [jest](https://jestjs.io/) to run unit tests and coverage.
78
+
79
+ ```bash
80
+ // To run tests
81
+ npm test
82
+ // To run tests with code coverage
83
+ npm run test:coverage
84
+ ```
85
+
86
+ ## Usage
87
+
88
+ For help getting started with `@azure/msal-react` please see our [getting started](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/getting-started.md) doc.
89
+
90
+ Migrating from [react-aad-msal](https://www.npmjs.com/package/react-aad-msal)? Check out our [migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/migration-guide.md).
91
+
92
+ ### MSAL Basics
93
+
94
+ Since `@azure/msal-react` is a wrapper around `@azure/msal-browser` many docs from the `msal-browser` repo are relevant here as well. For concepts specific to `@azure/msal-react` please see [below](#msal-react-specific-concepts)
95
+
96
+ 1. [Initialization](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md)
97
+ 1. [Acquiring and using an access token](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/acquire-token.md)
98
+ 1. [Managing token lifetimes](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/token-lifetimes.md)
99
+ 1. [Managing Accounts](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/Accounts.md)
100
+ 1. [Logging out](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/logout.md)
101
+
102
+ ### Advanced Topics
103
+
104
+ - [Configuration Options](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md)
105
+ - [Request and Response Details](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/request-response-object.md)
106
+ - [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/events.md)
107
+ - [Cache Storage](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/caching.md)
108
+ - [Performance Enhancements](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/performance.md)
109
+
110
+ ### MSAL React Specific Concepts
111
+
112
+ 1. [Hooks](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/hooks.md)
113
+ 1. [Events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/events.md)
114
+ 1. [Class Components](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/class-components.md)
115
+ 1. [Performance](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/performance.md)
116
+
117
+ ## Samples
118
+
119
+ Our [samples directory](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples) contains several example apps you can spin up to see how this library can be used in different contexts.
120
+
121
+ - [Create React App (JS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/react-router-sample)
122
+ - [Create React App (TS) Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/typescript-sample)
123
+ - [Next.js Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/nextjs-sample)
124
+ - [Gatsby Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/gatsby-sample)
125
+ - [B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-react-samples/b2c-sample)
126
+
127
+ More advanced samples backed with a tutorial can be found in the [Azure Samples](https://github.com/Azure-Samples) space on GitHub:
128
+
129
+ - [React SPA calling Express.js web API](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/1-call-api)
130
+ - [React SPA calling Express.js web API using App Roles and RBAC](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl/1-call-api-roles)
131
+ - [React SPA calling Microsoft Graph via Express.js web API using on-behalf-of flow](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/6-AdvancedScenarios/1-call-api-obo)
132
+ - [Deployment tutorial for Azure Static Web Apps](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/4-Deployment/2-deploy-static)
133
+
134
+ ## Security Reporting
135
+
136
+ If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.
137
+
138
+ ## License
139
+
140
+ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
141
+
142
+ ## We Value and Adhere to the Microsoft Open Source Code of Conduct
143
+
144
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -1,10 +1,10 @@
1
- import * as React from "react";
2
- import { IPublicClientApplication, Logger, InteractionStatus, AccountInfo } from "@azure/msal-browser";
3
- export interface IMsalContext {
4
- instance: IPublicClientApplication;
5
- inProgress: InteractionStatus;
6
- accounts: AccountInfo[];
7
- logger: Logger;
8
- }
9
- export declare const MsalContext: React.Context<IMsalContext>;
10
- export declare const MsalConsumer: React.Consumer<IMsalContext>;
1
+ import * as React from "react";
2
+ import { IPublicClientApplication, Logger, InteractionStatus, AccountInfo } from "@azure/msal-browser";
3
+ export interface IMsalContext {
4
+ instance: IPublicClientApplication;
5
+ inProgress: InteractionStatus;
6
+ accounts: AccountInfo[];
7
+ logger: Logger;
8
+ }
9
+ export declare const MsalContext: React.Context<IMsalContext>;
10
+ export declare const MsalConsumer: React.Consumer<IMsalContext>;
@@ -1,23 +1,23 @@
1
- /*! @azure/msal-react v2.0.0-alpha.1 2023-05-08 */
1
+ /*! @azure/msal-react v2.0.0-alpha.2 2023-05-17 */
2
2
  'use strict';
3
3
  import * as React from 'react';
4
4
  import { stubbedPublicClientApplication, InteractionStatus, Logger } from '@azure/msal-browser';
5
5
 
6
- /*
7
- * Copyright (c) Microsoft Corporation. All rights reserved.
8
- * Licensed under the MIT License.
9
- */
10
- /*
11
- * Stubbed context implementation
12
- * Only used when there is no provider, which is an unsupported scenario
13
- */
14
- const defaultMsalContext = {
15
- instance: stubbedPublicClientApplication,
16
- inProgress: InteractionStatus.None,
17
- accounts: [],
18
- logger: new Logger({}),
19
- };
20
- const MsalContext = React.createContext(defaultMsalContext);
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ /*
11
+ * Stubbed context implementation
12
+ * Only used when there is no provider, which is an unsupported scenario
13
+ */
14
+ const defaultMsalContext = {
15
+ instance: stubbedPublicClientApplication,
16
+ inProgress: InteractionStatus.None,
17
+ accounts: [],
18
+ logger: new Logger({}),
19
+ };
20
+ const MsalContext = React.createContext(defaultMsalContext);
21
21
  const MsalConsumer = MsalContext.Consumer;
22
22
 
23
23
  export { MsalConsumer, MsalContext };
@@ -1,9 +1,9 @@
1
- import React, { PropsWithChildren } from "react";
2
- import { IPublicClientApplication } from "@azure/msal-browser";
3
- export type MsalProviderProps = PropsWithChildren<{
4
- instance: IPublicClientApplication;
5
- }>;
6
- /**
7
- * MSAL context provider component. This must be rendered above any other components that use MSAL.
8
- */
9
- export declare function MsalProvider({ instance, children, }: MsalProviderProps): React.ReactElement;
1
+ import React, { PropsWithChildren } from "react";
2
+ import { IPublicClientApplication } from "@azure/msal-browser";
3
+ export type MsalProviderProps = PropsWithChildren<{
4
+ instance: IPublicClientApplication;
5
+ }>;
6
+ /**
7
+ * MSAL context provider component. This must be rendered above any other components that use MSAL.
8
+ */
9
+ export declare function MsalProvider({ instance, children, }: MsalProviderProps): React.ReactElement;