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
Copy file name to clipboardExpand all lines: articles/active-directory/develop/tutorial-v2-nodejs-webapp-msal.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,9 @@ manager: CelesteDG
8
8
ms.service: active-directory
9
9
ms.subservice: develop
10
10
ms.topic: tutorial
11
-
ms.date: 02/17/2021
11
+
ms.date: 11/09/2022
12
12
ms.author: cwerner
13
+
ms.custom: engagement-fy23
13
14
---
14
15
15
16
# 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:
26
27
> - Add code for user login
27
28
> - Test the app
28
29
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.
30
31
31
32
## Prerequisites
32
33
@@ -62,7 +63,7 @@ Use the [Express application generator tool](https://expressjs.com/en/starter/ge
62
63
npm install
63
64
```
64
65
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:
66
67
67
68
```
68
69
ExpressWebApp/
@@ -102,7 +103,7 @@ The web app sample in this tutorial uses the [express-session](https://www.npmjs
102
103
103
104
## Add app registration details
104
105
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:
@@ -111,7 +112,7 @@ Fill in these details with the values you obtain from Azure app registration por
111
112
-`Enter_the_Cloud_Instance_Id_Here`: The Azure cloud instance in which your application is registered.
112
113
- For the main (or *global*) Azure cloud, enter `https://login.microsoftonline.com/` (include the trailing forward-slash).
113
114
- 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:
115
116
- If your application supports *accounts in this organizational directory*, replace this value with the **Tenant ID** or **Tenant name**. For example, `contoso.microsoft.com`.
116
117
- If your application supports *accounts in any organizational directory*, replace this value with `organizations`.
117
118
- 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
@@ -166,7 +167,7 @@ Create a file named *fetch.js* in the root of your project and add the following
166
167
167
168
## Register routers and add state management
168
169
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:
@@ -210,7 +211,7 @@ You've completed creation of the application and are now ready to test the app's
210
211
211
212
## How the application works
212
213
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.
0 commit comments