Skip to content

Commit 6e8570e

Browse files
Merge pull request #246189 from kengaderdus/convert-node-web-app-content-to-tutorial
[CIAM] Convert node web app content to tutorial.
2 parents b62045b + 82b77d3 commit 6e8570e

21 files changed

+286
-249
lines changed

.openpublishing.redirection.active-directory.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,26 @@
16001600
"redirect_url": "/azure/active-directory/external-identities/customers/web-app-quickstart-portal-node-js-ciam",
16011601
"redirect_document_id": true
16021602
},
1603+
{
1604+
"source_path_from_root": "/articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-overview.md",
1605+
"redirect_url": "/azure/active-directory/external-identities/customers/tutorial-web-app-node-sign-in-prepare-tenant",
1606+
"redirect_document_id": true
1607+
},
1608+
{
1609+
"source_path_from_root": "/articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-prepare-tenant.md",
1610+
"redirect_url": "/azure/active-directory/external-identities/customers/tutorial-web-app-node-sign-in-prepare-tenant",
1611+
"redirect_document_id": false
1612+
},
1613+
{
1614+
"source_path_from_root": "/articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-prepare-app.md",
1615+
"redirect_url": "/azure/active-directory/external-identities/customers/tutorial-web-app-node-sign-in-prepare-tenant",
1616+
"redirect_document_id": false
1617+
},
1618+
{
1619+
"source_path_from_root": "/articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-sign-in-out.md",
1620+
"redirect_url": "/azure/active-directory/external-identities/customers/tutorial-web-app-node-sign-in-prepare-tenant",
1621+
"redirect_document_id": false
1622+
},
16031623
{
16041624
"source_path_from_root": "/articles/active-directory/external-identities/customers/how-to-daemon-node-call-api-overview.md",
16051625
"redirect_url": "/azure/active-directory/external-identities/customers/tutorial-daemon-node-call-api-prepare-tenant",

articles/active-directory/external-identities/customers/how-to-register-ciam-app.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ During app registration, you specify the redirect URI. The redirect URI is the e
2424

2525
Azure AD for customers supports authentication for various modern application architectures, for example web app or single-page app. The interaction of each application type with the customer tenant is different, therefore, you must specify the type of application you want to register.
2626

27-
In this article, you’ll learn how to register an application in your customer tenant.
27+
In this article, you learn how to register an application in your customer tenant.
2828

2929
## Prerequisites
3030

@@ -34,9 +34,11 @@ In this article, you’ll learn how to register an application in your customer
3434
## Choose your app type
3535

3636
# [Single-page app (SPA)](#tab/spa)
37-
## How to register your Single-page app?
37+
## Register your Single-page app
3838

39-
The following steps show you how to register your app in the admin center:
39+
Azure AD for customers supports authentication for Single-page apps (SPAs).
40+
41+
The following steps show you how to register your SPA in the Microsoft Entra admin center:
4042

4143
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/).
4244

@@ -54,7 +56,7 @@ The following steps show you how to register your app in the admin center:
5456

5557
1. In the **Register an application page** that appears, enter your application's registration information:
5658

57-
1. In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example *ciam-client-app*.
59+
1. In the **Name** section, enter a meaningful application name that is displayed to users of the app, for example *ciam-client-app*.
5860

5961
1. Under **Supported account types**, select **Accounts in this organizational directory only**.
6062

@@ -66,12 +68,15 @@ The following steps show you how to register your app in the admin center:
6668

6769
[!INCLUDE [add about redirect URI](../customers/includes/register-app/about-redirect-url.md)]
6870

69-
### Add delegated permissions
71+
### Grant delegated permissions
7072
This app signs in users. You can add delegated permissions to it, by following the steps below:
7173

7274
[!INCLUDE [grant permision for signing in users](../customers/includes/register-app/grant-api-permission-sign-in.md)]
7375

74-
### To call an API follow the steps below (optional):
76+
### Grant API permissions (optional):
77+
78+
If your SPA needs to call an API, you must grant your SPA API permissions so it can call the API. You must also [register the web API](how-to-register-ciam-app.md?tabs=webapi) that you need to call.
79+
7580
[!INCLUDE [grant permisions for calling an API](../customers/includes/register-app/grant-api-permission-call-api.md)]
7681

7782
If you'd like to learn how to expose the permissions by adding a link, go to the [Web API](how-to-register-ciam-app.md?tabs=webapi) section.
@@ -82,9 +87,11 @@ If you'd like to learn how to expose the permissions by adding a link, go to the
8287
- [Sign in users in a sample vanilla JavaScript single-page app](how-to-single-page-app-vanillajs-sample-sign-in.md)
8388

8489
# [Web app](#tab/webapp)
85-
## How to register your Web app?
90+
## Register your Web app
91+
92+
Azure AD for customers supports authentication for web apps.
8693

87-
The following steps show you how to register your app in the admin center:
94+
The following steps show you how to register your web app in the Microsoft Entra admin center:
8895

8996
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/).
9097

@@ -102,11 +109,11 @@ The following steps show you how to register your app in the admin center:
102109

103110
1. In the **Register an application page** that appears, enter your application's registration information:
104111

105-
1. In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example *ciam-client-app*.
112+
1. In the **Name** section, enter a meaningful application name that is displayed to users of the app, for example *ciam-client-app*.
106113

107114
1. Under **Supported account types**, select **Accounts in this organizational directory only**.
108115

109-
1. Under **Redirect URI (optional)**, select **Web** and then, in the URL box, enter `http://localhost:3000/`.
116+
1. Under **Redirect URI (optional)**, select **Web** and then, in the URL box, enter a URL such as, `http://localhost:3000/`.
110117

111118
1. Select **Register**.
112119

@@ -122,7 +129,10 @@ This app signs in users. You can add delegated permissions to it, by following t
122129
### Create a client secret 
123130
[!INCLUDE [add a client secret](../customers/includes/register-app/add-app-client-secret.md)]
124131

125-
### To call an API follow the steps below (optional):
132+
### Grant API permissions (optional)
133+
134+
If your web app needs to call an API, you must grant your web app API permissions so it can call the API. You must also [register the web API](how-to-register-ciam-app.md?tabs=webapi) that you need to call.
135+
126136
[!INCLUDE [grant permissions for calling an API](../customers/includes/register-app/grant-api-permission-call-api.md)]
127137

128138
## Next steps
@@ -131,15 +141,16 @@ This app signs in users. You can add delegated permissions to it, by following t
131141
- [Sign in users in a sample Node.js web app](how-to-web-app-node-sample-sign-in.md)
132142

133143
# [Web API](#tab/webapi)
134-
## How to register your Web API?
144+
## Register your Web API
145+
135146

136147
[!INCLUDE [register app](../customers/includes/register-app/register-api-app.md)]
137148

138149
### Expose permissions
139150

140151
[!INCLUDE [expose permissions](../customers/includes/register-app/add-api-scopes.md)]
141152

142-
### To add app roles follow the steps below (optional):
153+
### Add app roles
143154

144155
[!INCLUDE [configure app roles](../customers/includes/register-app/add-app-role.md)]
145156

@@ -148,9 +159,9 @@ This app signs in users. You can add delegated permissions to it, by following t
148159
- [Create a sign-up and sign-in user flow](how-to-user-flow-sign-up-sign-in-customers.md)
149160

150161
# [Desktop or Mobile app](#tab/desktopmobileapp)
151-
## How to register your Desktop or Mobile app?
162+
## Register your Desktop or Mobile app
152163

153-
The following steps show you how to register your app in the admin center:
164+
The following steps show you how to register your app in the Microsoft Entra admin center:
154165

155166
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/).
156167

@@ -168,7 +179,7 @@ The following steps show you how to register your app in the admin center:
168179

169180
1. In the **Register an application page** that appears, enter your application's registration information:
170181

171-
1. In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example *ciam-client-app*.
182+
1. In the **Name** section, enter a meaningful application name that is displayed to users of the app, for example *ciam-client-app*.
172183

173184
1. Under **Supported account types**, select **Accounts in this organizational directory only**.
174185

@@ -181,7 +192,9 @@ The following steps show you how to register your app in the admin center:
181192
### Add delegated permissions
182193
[!INCLUDE [grant permission for signing in users](../customers/includes/register-app/grant-api-permission-sign-in.md)]
183194

184-
### To call an API follow the steps below (optional):
195+
### Grant API permissions (optional)
196+
197+
If your mobile app needs to call an API, you must grant your mobile app API permissions so it can call the API. You must also [register the web API](how-to-register-ciam-app.md?tabs=webapi) that you need to call.
185198
[!INCLUDE [grant permissions for calling an API](../customers/includes/register-app/grant-api-permission-call-api.md)]
186199

187200
## Next steps
@@ -190,12 +203,13 @@ The following steps show you how to register your app in the admin center:
190203
- [Sign in users in a sample Electron desktop app](how-to-desktop-app-electron-sample-sign-in.md)
191204

192205
# [Daemon app](#tab/daemonapp)
193-
## How to register your Daemon app?
206+
## Register your Daemon app
194207

195208
[!INCLUDE [register daemon app](../customers/includes/register-app/register-daemon-app.md)]
196209

197-
### To call an API follow the steps below (optional)
198-
A daemon app signs-in as itself using the [OAuth 2.0 client credentials flow](/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow), you add application permissions, which is required by apps that authenticate as themselves:
210+
### Grant API permissions
211+
212+
A daemon app signs-in as itself using the [OAuth 2.0 client credentials flow](/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow). You grant application permissions (app roles), which is required by apps that authenticate as themselves. You must also [register the web API](how-to-register-ciam-app.md?tabs=webapi) that your daemon app needs to call.
199213

200214
[!INCLUDE [register daemon app](../customers/includes/register-app/grant-api-permissions-app-permissions.md)]
201215

@@ -205,7 +219,7 @@ A daemon app signs-in as itself using the [OAuth 2.0 client credentials flow](/a
205219
- [Create a sign-up and sign-in user flow](how-to-user-flow-sign-up-sign-in-customers.md)
206220

207221
# [Microsoft Graph API](#tab/graphapi)
208-
## How to register a Microsoft Graph API application?
222+
## Register a Microsoft Graph API application
209223
[!INCLUDE [register client app](../customers/includes/register-app/register-client-app-common.md)]
210224

211225
### Grant API Access to your application
@@ -215,4 +229,4 @@ A daemon app signs-in as itself using the [OAuth 2.0 client credentials flow](/a
215229
[!INCLUDE [add app client secret](../customers/includes/register-app/add-app-client-secret.md)]
216230

217231
## Next steps
218-
- Learn more how to manage [Azure Active Directory for customers resources with Microsoft Graph](microsoft-graph-operations.md)
232+
- Learn more how to manage [Azure Active Directory for customers resources with Microsoft Graph](microsoft-graph-operations.md)

articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-call-api-call-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ You may want to:
201201

202202
- [Configure sign-in with Google](how-to-google-federation-customers.md)
203203

204-
- [Sign in users in your own Node.js web application](how-to-web-app-node-sign-in-overview.md)
204+
- [Sign in users in your own Node.js web application](tutorial-web-app-node-sign-in-prepare-tenant.md)

articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-call-api-prepare-tenant.md

Lines changed: 1 addition & 1 deletion
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: 07/26/2023
13+
ms.date: 07/28/2023
1414
ms.custom: developer, devx-track-js
1515
---
1616

articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-call-api-sign-in-acquire-access-token.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The `/` route is the entry point to the application. It renders the `views/index
119119
120120
1. In your code editor, open *auth/AuthProvider.js* file, then add the code from [AuthProvider.js](https://github.com/Azure-Samples/ms-identity-ciam-javascript-tutorial/blob/main/2-Authorization/4-call-api-express/App/auth/AuthProvider.js) to it.
121121
122-
The `/signin`, `/signout` and `/redirect` routes are defined in the *routes/auth.js* file, but their logic live in *auth/AuthProvider.js* file.
122+
The `/signin`, `/signout` and `/redirect` routes are defined in the *routes/auth.js* file, but you implement their logic in *auth/AuthProvider.js* file.
123123
124124
- The `login` method handles`/signin` route:
125125
@@ -259,7 +259,7 @@ In your code editor, open *routes/users.js* file, then add the following code:
259259
260260
module.exports = router;
261261
```
262-
If the user is authenticated, the `/id` route displays ID token claims by using the `views/id.hbs` view. You added this view earlier in [Build app UI components](how-to-web-app-node-sign-in-prepare-app.md#build-app-ui-components).
262+
If the user is authenticated, the `/id` route displays ID token claims by using the `views/id.hbs` view. You added this view earlier in [Build app UI components](tutorial-web-app-node-sign-in-prepare-app.md#build-app-ui-components).
263263
To extract a specific ID token claim, such as *given name*:
264264
```javascript
265265
const givenName = req.session.account.idTokenClaims.given_name

articles/active-directory/external-identities/customers/how-to-web-app-node-sign-in-overview.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

articles/active-directory/external-identities/customers/how-to-web-app-node-use-certificate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Once you associate your app registration with the certificate, you need to updat
168168
});
169169
//...
170170
```
171-
1. Use the steps in [Run and test the web app](how-to-web-app-node-sign-in-sign-in-out.md#run-and-test-the-web-app) to test your app.
171+
1. Use the steps in [Run and test the web app](tutorial-web-app-node-sign-in-sign-out.md#run-and-test-the-web-app) to test your app.
172172
173173
## Use a self-signed certificate directly from Azure Key Vault
174174
@@ -261,7 +261,7 @@ You can use your existing certificate directly from Azure Key Vault:
261261
}
262262
```
263263

264-
1. Use the steps in [Run and test the web app](how-to-web-app-node-sign-in-sign-in-out.md#run-and-test-the-web-app) to test your app.
264+
1. Use the steps in [Run and test the web app](tutorial-web-app-node-sign-in-sign-out.md#run-and-test-the-web-app) to test your app.
265265

266266
## Next steps
267267

articles/active-directory/external-identities/customers/how-to-web-app-role-based-access-control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In this article, you learn how to receive user roles or group membership or both
2828

2929
- If you've not done so, complete the steps in [Using role-based access control for applications](how-to-use-app-roles-customers.md) article. This article shows you how to create roles for your application, how to assign users and groups to those roles, how to add members to a group and how to add a group claim to a to security token. Learn more about [ID tokens](../../develop/id-tokens.md) and [access tokens](../../develop/access-tokens.md).
3030

31-
- If you've not done so, complete the steps in [Sign in users in your own Node.js web application](how-to-web-app-node-sign-in-overview.md)
31+
- If you've not done so, complete the steps in [Sign in users in your own Node.js web application](tutorial-web-app-node-sign-in-prepare-tenant.md)
3232

3333
## Receive groups and roles claims in your Node.js web app
3434

articles/active-directory/external-identities/customers/includes/register-app/add-api-scopes.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ An API needs to publish a minimum of one scope, also called [Delegated Permissio
1313
1. Under **Manage**, select **Expose an API**.
1414
1. At the top of the page, next to **Application ID URI**, select the **Add** link to generate a URI that is unique for this app.
1515
1. Accept the proposed Application ID URI such as `api://{clientId}`, and select **Save**. When your web application requests an access token for the web API, it adds the URI as the prefix for each scope that you define for the API.
16+
1617
1. Under **Scopes defined by this API**, select **Add a scope**.
17-
18-
1. For **Scope name**, enter *ToDoList.Read*.
19-
1. For **Admin consent display name**, enter *Read users ToDo list using the 'TodoListApi'*.
20-
1. For **Admin consent description**, enter *Allow the app to read the user's ToDo list using the 'TodoListApi'*.
21-
1. Keep **State** as **Enabled** and select **Add scope**.
18+
19+
1. Enter the following values that define a read access to the API, then select **Add scope** to save your changes:
2220

2321

24-
1. Select **Add a scope** again, and enter the following values for the second scope that defines read and write access to the API. Select **Add scope** to save your changes:
22+
| Property | Value |
23+
|----------|-------|
24+
| Scope name | *ToDoList.Read* |
25+
| Who can consent | **Admins only** |
26+
| Admin consent display name | *Read users ToDo list using the 'TodoListApi'* |
27+
| Admin consent description | *Allow the app to read the user's ToDo list using the 'TodoListApi'*. |
28+
| State | **Enabled** |
29+
30+
1. Select **Add a scope** again, and enter the following values that define a read and write access scope to the API. Select **Add scope** to save your changes:
2531

2632
| Property | Value |
2733
|----------|-------|

0 commit comments

Comments
 (0)