Skip to content

Commit e1e1080

Browse files
authored
Merge pull request #217698 from henrymbuguakiarie/msid-content-health-tutorial-v2-nodejs-webapp-msal
[msid][content-health] tutorial-v2-nodejs-webapp-msal (ADO-2158954)
2 parents af9a692 + 3d90794 commit e1e1080

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.whatsnew/.application-management.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"areas": [
1919
{
20-
"name": ".",
20+
"name": [ "."],
2121
"heading": "Azure Active Directory application management"
2222
}
2323
]

articles/active-directory/develop/tutorial-v2-nodejs-webapp-msal.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ manager: CelesteDG
88
ms.service: active-directory
99
ms.subservice: develop
1010
ms.topic: tutorial
11-
ms.date: 02/17/2021
11+
ms.date: 11/09/2022
1212
ms.author: cwerner
13+
ms.custom: engagement-fy23
1314
---
1415

1516
# Tutorial: Sign in users and acquire a token for Microsoft Graph in a Node.js & Express web app
@@ -26,7 +27,7 @@ Follow the steps in this tutorial to:
2627
> - Add code for user login
2728
> - Test the app
2829
29-
For additional guidance, refer to the [sample code](https://github.com/Azure-Samples/ms-identity-node) that shows how to use MSAL Node to login, logout and acquire an access token for a protected resource such as Microsoft Graph.
30+
For more information, see the [sample code](https://github.com/Azure-Samples/ms-identity-node) that shows how to use MSAL Node to sign in, sign out and acquire an access token for a protected resource such as Microsoft Graph.
3031

3132
## Prerequisites
3233

@@ -62,7 +63,7 @@ Use the [Express application generator tool](https://expressjs.com/en/starter/ge
6263
npm install
6364
```
6465

65-
You now have a simple Express web app. The file and folder structure of your project should look similar to the following:
66+
You now have a simple Express web app. The file and folder structure of your project should look similar to the following folder structure:
6667

6768
```
6869
ExpressWebApp/
@@ -102,7 +103,7 @@ The web app sample in this tutorial uses the [express-session](https://www.npmjs
102103

103104
## Add app registration details
104105

105-
1. Create a *.env* file in the root of your project folder. Then add the following code:
106+
1. Create an *.env* file in the root of your project folder. Then add the following code:
106107

107108
:::code language="text" source="~/ms-identity-node/App/.env":::
108109

@@ -111,7 +112,7 @@ Fill in these details with the values you obtain from Azure app registration por
111112
- `Enter_the_Cloud_Instance_Id_Here`: The Azure cloud instance in which your application is registered.
112113
- For the main (or *global*) Azure cloud, enter `https://login.microsoftonline.com/` (include the trailing forward-slash).
113114
- For **national** clouds (for example, China), you can find appropriate values in [National clouds](authentication-national-cloud.md).
114-
- `Enter_the_Tenant_Info_here` should be one of the following:
115+
- `Enter_the_Tenant_Info_here` should be one of the following parameters:
115116
- If your application supports *accounts in this organizational directory*, replace this value with the **Tenant ID** or **Tenant name**. For example, `contoso.microsoft.com`.
116117
- If your application supports *accounts in any organizational directory*, replace this value with `organizations`.
117118
- If your application supports *accounts in any organizational directory and personal Microsoft accounts*, replace this value with `common`.
@@ -130,17 +131,17 @@ Fill in these details with the values you obtain from Azure app registration por
130131

131132
:::code language="js" source="~/ms-identity-node/App/authConfig.js":::
132133

133-
## Add code for user login and token acquisition
134+
## Add code for user sign-in and token acquisition
134135

135136
1. Create a new file named *auth.js* under the *router* folder and add the following code there:
136137

137138
:::code language="js" source="~/ms-identity-node/App/routes/auth.js":::
138139

139-
2. Next, update the *index.js* route by replacing the existing code with the following:
140+
2. Next, update the *index.js* route by replacing the existing code with the following code snippet:
140141

141142
:::code language="js" source="~/ms-identity-node/App/routes/index.js":::
142143

143-
3. Finally, update the *users.js* route by replacing the existing code with the following:
144+
3. Finally, update the *users.js* route by replacing the existing code with the following code snippet:
144145

145146
:::code language="js" source="~/ms-identity-node/App/routes/users.js":::
146147

@@ -166,7 +167,7 @@ Create a file named *fetch.js* in the root of your project and add the following
166167

167168
## Register routers and add state management
168169

169-
In the *app.js* file in the root of the project folder, register the routes you have created earlier and add session support for tracking authentication state using the **express-session** package. Replace the existing code there with the following:
170+
In the *app.js* file in the root of the project folder, register the routes you've created earlier and add session support for tracking authentication state using the **express-session** package. Replace the existing code there with the following code snippet:
170171

171172
:::code language="js" source="~/ms-identity-node/App/app.js":::
172173

@@ -210,7 +211,7 @@ You've completed creation of the application and are now ready to test the app's
210211

211212
## How the application works
212213

213-
In this tutorial, you instantiated an MSAL Node [ConfidentialClientApplication](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-confidential-client-application.md) object by passing it a configuration object (*msalConfig*) that contains parameters obtained from your Azure AD app registration on Azure portal. The web app you created uses the [OpenID Connect protocol](./v2-protocols-oidc.md) to sign-in users and the [OAuth 2.0 Authorization code grant flow](./v2-oauth2-auth-code-flow.md) obtain access tokens.
214+
In this tutorial, you instantiated an MSAL Node [ConfidentialClientApplication](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-confidential-client-application.md) object by passing it a configuration object (*msalConfig*) that contains parameters obtained from your Azure AD app registration on Azure portal. The web app you created uses the [OpenID Connect protocol](./v2-protocols-oidc.md) to sign-in users and the [OAuth 2.0 authorization code flow](./v2-oauth2-auth-code-flow.md) to obtain access tokens.
214215

215216
## Next steps
216217

0 commit comments

Comments
 (0)