You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner. It is now read-only.
This simple sample demonstrates how to use the [Microsoft Authentication Library for JavaScript (msal.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to get an access token and call an API secured by Azure AD B2C.
16
16
17
+
**Note:** A quickstart guide covering this sample can be found [here](https://docs.microsoft.com/azure/active-directory-b2c/quickstart-single-page-app).
18
+
19
+
**Note:** A more detailed tutorial covering this sample can be found [here](https://docs.microsoft.com/azure/active-directory-b2c/tutorial-single-page-app).
|`authPopup.js`| Main authentication logic resides here (using Popup flow). |
28
+
|`authRedirect.js`| Use this instead of `authPopup.js` for authentication with redirect flow. |
29
+
|`authConfig.js`| Contains configuration parameters for the sample. |
30
+
|`api.js`| Provides a helper function for calling the web API. |
31
+
|`apiConfig.js`| Contains API endpoint and scope. |
32
+
|`ui.js`| Contains UI logic. |
33
+
|`policies.js`| Contains policies and authority strings. |
34
+
|`index.html`| Contains the UI of the sample. |
35
+
|`.gitignore`| Defines what to ignore at commit time. |
36
+
|`CHANGELOG.md`| List of changes to the sample. |
37
+
|`CODE_OF_CONDUCT.md`| Code of Conduct information. |
38
+
|`CONTRIBUTING.md`| Guidelines for contributing to the sample. |
39
+
|`LICENSE`| The license for the sample. |
40
+
|`package.json`| Package manifest for npm. |
41
+
|`README.md`| This README file. |
42
+
|`SECURITY.md`| Security disclosures. |
43
+
|`server.js`| Implements a simple Node server to serve index.html. |
44
+
45
+
## Prerequisites
46
+
47
+
-[Node](https://nodejs.org/en/) must be installed to run this sample.
48
+
- A modern web browser. This sample uses **ES6** conventions and will not run on **Internet Explorer**.
49
+
17
50
## How to run this sample
18
51
19
52
There are two ways to run this sample:
@@ -87,26 +120,19 @@ Now in the sample code, you can replace the single page application's demo envir
87
120
88
121
1. Open the `authConfig.js` file.
89
122
2. Find the assignment for `clientId` and replace the value with the Application ID for the single page application you registered earlier, for example the Application ID found in `My Test SPA` application in the Azure portal.
90
-
3. Find the assignment for `authority` and replacing `b2c_1_susi` with the name of the policy you created in Step 2, and `fabrikamb2c.onmicrosoft.com` by the name of your Azure AD B2C tenant, for example `https://<your-tenant-name>.b2clogin.com/<your-tenant-name>.onmicrosoft.com/<your-sign-in-sign-up-policy>`
91
-
4. Open the `apiConfig.js` file.
92
-
5. Find the assignment for the scopes `b2cScopes` replacing the URL by the scope URL you created for the Web API, e.g. `b2cScopes: ["https://<your-tenant-name>.onmicrosoft.com/helloapi/demo.read"]`
93
-
6. Find the assignment for API URL `webApi` replacing the current URL by the URL where you deployed your Web API in Step 4, e.g. `webApi: http://localhost:5000/hello`
123
+
3. Open the `policies.js` file.
124
+
4. Find the entries for `names` and `authorities` and replacing, as appropriate, with the names of the policies you created in Step 2, and `fabrikamb2c.onmicrosoft.com` by the name of your Azure AD B2C tenant, for example `https://<your-tenant-name>.b2clogin.com/<your-tenant-name>.onmicrosoft.com/<your-sign-in-sign-up-policy>`
125
+
5. Open the `apiConfig.js` file.
126
+
6. Find the assignment for the scopes `b2cScopes` replacing the URL by the scope URL you created for the Web API, e.g. `b2cScopes: ["https://<your-tenant-name>.onmicrosoft.com/helloapi/demo.read"]`
127
+
7. Find the assignment for API URL `webApi` replacing the current URL by the URL where you deployed your Web API in Step 4, e.g. `webApi: http://localhost:5000/hello`
0 commit comments