Skip to content

Commit e57582a

Browse files
committed
update-commit
1 parent 6136c13 commit e57582a

5 files changed

+49
-35
lines changed

articles/active-directory/external-identities/customers/how-to-single-page-app-vanillajs-configure-authentication.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.service: active-directory
1010
ms.workload: identity
1111
ms.subservice: ciam
1212
ms.topic: how-to
13-
ms.date: 05/23/2023
13+
ms.date: 05/25/2023
1414
ms.custom: developer
1515

1616
#Customer intent: As a developer, I want to learn how to configure vanilla JavaScript single-page app (SPA) to sign in and sign out users with my Azure Active Directory (AD) for customers tenant.
@@ -28,9 +28,7 @@ In the previous article, you created a vanilla JavaScript (JS) single-page appli
2828

2929
The application uses the [Implicit Grant Flow](../../develop/v2-oauth2-implicit-grant-flow.md) to authenticate users. The Implicit Grant Flow is a browser-based flow that doesn't require a back-end server. The flow redirects the user to the sign-in page, where the user signs in and consents to the permissions that are being requested by the application. The purpose of *authConfig.js* is to configure the authentication flow.
3030

31-
1. In your IDE, create a new folder and name it **public**
32-
1. In the *public* folder, create a new file and name it *authConfig.js*.
33-
1. Open *authConfig.js* and add the following code snippet:
31+
1. In the *public* folder, open *authConfig.js* and add the following code snippet:
3432

3533
```javascript
3634
/**
@@ -93,16 +91,15 @@ The application uses the [Implicit Grant Flow](../../develop/v2-oauth2-implicit-
9391
}
9492
```
9593

96-
1. Find the `Enter_the_Application_Id_Here` value and replace it with the application ID (clientId) of the app you registered in the Microsoft Entra admin center.
94+
1. Find the `Enter_the_Application_Id_Here` value and replace it with the **application ID (clientId)** of the app you registered in the Microsoft Entra admin center.
9795
1. In **Authority**, find `Enter_the_Tenant_Subdomain_Here` and replace it with the subdomain of your tenant. For example, if your tenant primary domain is *caseyjensen@onmicrosoft.com*, the value you should enter is *casyjensen*.
9896
1. Save the file.
9997

10098
## Creating the redirection file
10199

102-
A redirection file is required to handle the response from the sign-in page. The redirection file is used to extract the access token from the URL fragment and use it to call the protected API.
100+
A redirection file is required to handle the response from the sign-in page. The redirection file is used to extract the access token from the URL fragment and use it to call the protected API. The redirection file is also used to handle errors that occur during the authentication process.
103101

104-
1. In the *public* folder, create a new file and name it *authRedirect.js*.
105-
1. Open *authRedirect.js* and add the following code snippet:
102+
1. In the *public* folder, open *authRedirect.js* and add the following code snippet:
106103

107104
```javascript
108105
// Create the main myMSALObj instance

articles/active-directory/external-identities/customers/how-to-single-page-app-vanillajs-prepare-app.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
---
2-
title: Prepare a vanilla JavaScript single-page app for authentication
2+
title: Prepare your vanilla JavaScript single-page application for authentication
33
description: Learn how to prepare a vanilla JavaScript single-page app (SPA) for authentication and authorization with your Azure Active Directory (AD) for customers tenant.
44
services: active-directory
55
author: OwenRichards1
66
manager: CelesteDG
77
ms.author: owenrichards
88
ms.service: active-directory
9-
ms.workload: identity
109
ms.subservice: ciam
1110
ms.topic: how-to
12-
ms.date: 05/23/2023
13-
ms.custom: developer
11+
ms.date: 05/24/2023
1412

1513
#Customer intent: As a developer, I want to learn how to configure vanilla JavaScript single-page app (SPA) to sign in and sign out users with my Azure AD for customers tenant.
1614
---
1715

18-
# Prepare a Single-page application for authentication
16+
# Prepare your vanilla JavaScript single-page application for authentication
1917

2018
After registering an application and creating a user flow in a Azure Active Directory (AD) for customers tenant, a vanilla JavaScript (JS) single-page application (SPA) can be created using an integrated development environment (IDE) or a code editor. In this article, you'll create a vanilla JS SPA and a server to host the application.
2119

2220
## Prerequisites
2321

24-
- Completion of the prerequisites and steps in [Sign in users to a vanilla JS Single-page application](how-to-single-page-app-vanillajs-prepare-tenant.md).
25-
- Although any IDE that supports vanilla JS applications can be used, **Visual Studio Code** is used for this guide. It can be downloaded from the [Downloads](https://visualstudio.microsoft.com/downloads) page.
22+
- Completion of the prerequisites and steps in [Sign in users to a vanilla JS single-page application](how-to-single-page-app-vanillajs-prepare-tenant.md).
23+
- Although any IDE that supports vanilla JS applications can be used, **Visual Studio Code** is recommended for this guide. It can be downloaded from the [Downloads](https://visualstudio.microsoft.com/downloads) page.
2624
- [Node.js](https://nodejs.org/en/download/).
2725

2826
## Create a new vanilla JS project and install dependencies
@@ -33,6 +31,21 @@ After registering an application and creating a user flow in a Azure Active Dire
3331
```powershell
3432
npm init -y
3533
```
34+
1. Create additional folders and files to achieve the following project structure:
35+
36+
```
37+
└── public
38+
└── authConfig.js
39+
└── authPopup.js
40+
└── authRedirect.js
41+
└── index.html
42+
└── signout.html
43+
└── styles.css
44+
└── ui.js
45+
└── server.js
46+
```
47+
48+
## Install app dependencies
3649
3750
1. In the **Terminal**, run the following command to install the required dependencies for the project:
3851
@@ -87,6 +100,8 @@ After registering an application and creating a user flow in a Azure Active Dire
87100
88101
```
89102
103+
In this code, the **app** variable is initialized with the **express** module and **express** is used to serve the public assets. **Msal-browser** is served as a static asset and is used to initiate the authentication flow.
104+
90105
## Next steps
91106
92107
> [!div class="nextstepaction"]

articles/active-directory/external-identities/customers/how-to-single-page-app-vanillajs-prepare-tenant.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Prepare your tenant to use a vanilla JavaScript single-page app for authentication.
2+
title: Prepare your customer tenant to authenticate a vanilla JavaScript single-page application.
33
description: Learn how to configure your Azure Active Directory (AD) for customers tenant for authentication with a vanilla JavaScript single-page app (SPA).
44
services: active-directory
55
author: OwenRichards1
@@ -9,20 +9,19 @@ ms.service: active-directory
99
ms.workload: identity
1010
ms.subservice: ciam
1111
ms.topic: how-to
12-
ms.date: 05/23/2023
12+
ms.date: 05/24/2023
1313
ms.custom: developer
1414

1515
#Customer intent: As a developer, I want to learn how to configure vanilla JavaScript single-page app (SPA) to sign in and sign out users with my Azure Active Directory (AD) for customers tenant.
1616
---
1717

18-
# Sign in users to a vanilla JS single-page application - Prepare your tenant
18+
# Prepare your customer tenant to authenticate a vanilla JavaScript single-page application.
1919

2020
This how-to guide demonstrates how to prepare your Azure Active Directory (Azure AD) for customers tenant for authentication. You'll register a single-page application (SPA) in the Microsoft Entra admin center, and record its identifiers. You'll then create a sign in and sign out user flow in the Microsoft Entra admin center and associate your SPA with the user flow.
2121

2222
## Prerequisites
2323

2424
- Azure AD for customers tenant. If you don't already have one, [sign up for a free trial](https://aka.ms/ciam-free-trial?wt.mc_id=ciamcustomertenantfreetrial_linkclick_content_cnl).
25-
2625
- If you have already registered a SPA in the Microsoft Entra admin center, and associated it with a user flow, you can skip the steps in this article and move to [Prepare a vanilla JavaScript single-page app for authentication](how-to-single-page-app-vanillajs-prepare-app.md).
2726

2827
## Register the SPA

articles/active-directory/external-identities/customers/how-to-single-page-app-vanillajs-sample-sign-in.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ ms.service: active-directory
1010
ms.workload: identity
1111
ms.subservice: ciam
1212
ms.topic: how-to
13-
ms.date: 05/23/2023
13+
ms.date: 05/25/2023
1414
ms.custom: developer
1515

1616
#Customer intent: As a dev, devops, I want to learn about how to configure a sample vanilla JS SPA to sign in and sign out users with my Azure Active Directory (Azure AD) for customers tenant
1717
---
1818

1919
# Sign in users in a sample vanilla JavaScript single-page application
2020

21-
This how-to guide uses a sample vanilla JavaScript single-page Application (SPA) to demonstrate how to add authentication to a SPA. This SPA enables users to sign in and sign out by using their own Azure Azure Active Directory (AD) for customers tenant. The sample uses the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to handle authentication.
21+
This how-to guide uses a sample vanilla JavaScript single-page Application (SPA) to demonstrate how to add authentication to a SPA. The SPA enables users to sign in and sign out by using their own Azure Azure Active Directory (AD) for customers tenant. The sample uses the [Microsoft Authentication Library for JavaScript (MSAL.js)](https://github.com/AzureAD/microsoft-authentication-library-for-js) to handle authentication.
2222

2323
## Prerequisites
2424

25-
* Although any IDE that supports vanilla JS applications can be used, **Visual Studio Code** is used for this guide. It can be downloaded from the [Downloads](https://visualstudio.microsoft.com/downloads) page.
25+
* Although any IDE that supports vanilla JS applications can be used, **Visual Studio Code** is recommended for this guide. It can be downloaded from the [Downloads](https://visualstudio.microsoft.com/downloads) page.
2626
* [Node.js](https://nodejs.org/en/download/).
2727
* Azure AD for customers tenant. If you don't already have one, [sign up for a free trial](https://aka.ms/ciam-free-trial?wt.mc_id=ciamcustomertenantfreetrial_linkclick_content_cnl).
2828

@@ -103,4 +103,5 @@ If you choose to download the `.zip` file, extract the sample app file to a fold
103103
104104
## Next steps
105105
106-
Learn how to use the Microsoft Authentication Library (MSAL) for JavaScript to sign in users and acquire tokens to call Microsoft Graph.
106+
> [!div class="nextstepaction"]
107+
> [Enable self-service password reset](./how-to-enable-password-reset-customers.md)

articles/active-directory/external-identities/customers/how-to-single-page-app-vanillajs-sign-in-sign-out.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ ms.service: active-directory
1010
ms.workload: identity
1111
ms.subservice: ciam
1212
ms.topic: how-to
13-
ms.date: 05/23/2023
13+
ms.date: 05/24/2023
1414
ms.custom: developer
1515

1616
#Customer intent: As a developer, I want to learn how to configure vanilla JavaScript single-page app (SPA) to sign in and sign out users with my Azure Active Directory (AD) for customers tenant.
1717
---
1818

19-
# Configure a Single-page application User Interface and Sign-In
19+
# Configure a single-page application user interface and sign-In
2020

2121
When authorization has been configured, the user interface can be created to allow users to sign in and sign out when the project is run. To build the user interface (UI) for the application, [Bootstrap](https://getbootstrap.com/) is used to create a responsive UI that contains a **Sign-In** and **Sign-Out** button. Next, you'll run the project and test the sign-in and sign-out functionality.
2222

@@ -26,10 +26,9 @@ When authorization has been configured, the user interface can be created to all
2626

2727
## Create the *index.html* file
2828

29-
The main page of the application, *index.html*, is the first page that is loaded when the application is started. It's also the page that is loaded when the user selects the **Sign Out** button.
29+
The main page of the application, *index.html*, is the first page that is loaded when the application is started. It's also the page that is loaded when the user selects the **Sign-Out** button.
3030

31-
1. In the *public* folder, create a new file named *index.html*. This file contains the HTML for the main page of the application.
32-
1. Open *index.html* and add the following code snippet:
31+
1. In the *public* folder, open *index.html* and add the following code snippet:
3332

3433
```html
3534
<!DOCTYPE html>
@@ -103,8 +102,7 @@ The main page of the application, *index.html*, is the first page that is loaded
103102

104103
## Create the *signout.html* file
105104

106-
1. In the *public* folder, create a new file named *signout.html*. This file contains the HTML for the sign-out page of the application.
107-
1. Open *signout.html* and add the following code snippet:
105+
1. In the *public* folder, open *signout.html* and add the following code snippet:
108106

109107
```html
110108
<!DOCTYPE html>
@@ -132,8 +130,7 @@ The main page of the application, *index.html*, is the first page that is loaded
132130

133131
## Create the *ui.js* file
134132

135-
1. In the *public* folder, create a new file named *ui.js*. This file contains the JavaScript code for the UI of the application.
136-
1. Open *ui.js* and add the following code snippet:
133+
1. In the *public* folder, open *ui.js* and add the following code snippet:
137134

138135
```javascript
139136
// Select DOM elements to work with
@@ -173,8 +170,7 @@ The main page of the application, *index.html*, is the first page that is loaded
173170

174171
## Create the styles.css file
175172

176-
1. In the *public* folder, create a new file named *styles.css*. This file contains the CSS code for the UI of the application.
177-
1. Open *styles.css* and add the following code snippet:
173+
1. In the *public* folder, open *styles.css* and add the following code snippet:
178174

179175
```css
180176
.navbarStyle {
@@ -218,4 +214,10 @@ Now that all the required code snippets have been added, the application can be
218214
## Next steps
219215

220216
> [!div class="nextstepaction"]
221-
> [Enable self-service password reset](./how-to-enable-password-reset-customers.md)
217+
> [Enable self-service password reset](./how-to-enable-password-reset-customers.md)
218+
219+
## See also
220+
221+
- [Customize the default branding](how-to-customize-branding-customers.md)
222+
- [Configure sign-in with Google](how-to-google-federation-customers.md)
223+
- [Sign in users in your own ASP.NET web application by using an Azure AD for customers tenant](how-to-web-app-dotnet-sign-in-prepare-app.md)

0 commit comments

Comments
 (0)