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-b2c/active-directory-b2c-tutorials-web-api.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
-
title: Tutorial - Grant access to an ASP.NET web API - Azure Active Directory B2C | Microsoft Docs
2
+
title: Tutorial - Grant access to an ASP.NET web API - Azure Active Directory B2C
3
3
description: Tutorial on how to use Active Directory B2C to protect an ASP.NET web API and call it from an ASP.NET web application.
4
4
services: active-directory-b2c
5
5
author: mmacy
6
6
manager: celestedg
7
7
8
8
ms.author: marsma
9
-
ms.date: 02/04/2019
9
+
ms.date: 09/19/2019
10
10
ms.custom: mvc
11
11
ms.topic: tutorial
12
12
ms.service: active-directory
@@ -78,20 +78,20 @@ There are two projects in the sample solution:
78
78
79
79
The following two projects are in the sample solution:
80
80
81
-
-**TaskWebApp** - Create and edit a task list. The sample uses the **sign-up or sign-in** user flow to sign up or sign in users.
82
-
-**TaskService** - Supports the create, read, update, and delete task list functionality. The API is protected by Azure AD B2C and called by TaskWebApp.
81
+
***TaskWebApp** - Create and edit a task list. The sample uses the **sign-up or sign-in** user flow to sign up or sign in users.
82
+
***TaskService** - Supports the create, read, update, and delete task list functionality. The API is protected by Azure AD B2C and called by TaskWebApp.
83
83
84
84
### Configure the web application
85
85
86
86
1. Open the **B2C-WebAPI-DotNet** solution in Visual Studio.
87
-
2. Open **Web.config**in the**TaskWebApp** project.
88
-
3. To run the API locally, use the localhost setting for **api:TaskServiceUrl**. Change the Web.config as follows:
87
+
1. In the **TaskWebApp**project, open**Web.config**.
88
+
1. To run the API locally, use the localhost setting for **api:TaskServiceUrl**. Change the Web.config as follows:
3. Changethe**Action**for both projects to **Start**.
137
-
4. Click **OK** to save the configuration.
138
-
5. Press **F5** to run both applications. Each application opens in its own browser tab.
139
-
`https://localhost:44316/` is the web application.
140
-
`https://localhost:44332/` is the web API.
136
+
1. Select**Multiplestartupprojects**.
137
+
1. Changethe**Action**for both projects to **Start**.
138
+
1. Click **OK** to save the configuration.
139
+
1. Press **F5** to run both applications. Each application opens in its own browser window.
140
+
* `https://localhost:44316/` is the web application.
141
+
* `https://localhost:44332/` is the web API.
141
142
142
-
6. In the web application, click **sign-up / sign-in** to sign in to the web application. Use the account that you previously created.
143
-
7. After you sign in, click **To-do list** and create a to-do list item.
143
+
1. In the web application, select **sign-up / sign-in** to sign in to the web application. Use the account that you previously created.
144
+
1. After you sign in, select **To-do list** and create a to-do list item.
144
145
145
-
When you create a to-do list item, the web application makes a request to the web API to generate the to-do list item. You're protected web application is calling the protected web API in your Azure AD B2C tenant.
146
+
When you create a to-do list item, the web application makes a request to the web API to generate the to-do list item. Your protected web application is calling the web API protected by Azure AD B2C.
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/active-directory-b2c-tutorials-web-app.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: mmacy
6
6
manager: celestedg
7
7
8
8
ms.author: marsma
9
-
ms.date: 09/12/2019
9
+
ms.date: 09/19/2019
10
10
ms.custom: mvc
11
11
ms.topic: tutorial
12
12
ms.service: active-directory
@@ -36,13 +36,13 @@ In this tutorial, you learn how to:
36
36
In the tutorial that you completed as part of the prerequisites, you added a web application in Azure AD B2C. To enable communication with the sample in this tutorial, you need to add a redirect URI to the application in Azure AD B2C.
37
37
38
38
1. Sign in to the [Azure portal](https://portal.azure.com).
39
-
2. Make sure you're using the directory that contains your Azure AD B2C tenant by selecting the **Directory + subscription** filter in the top menu and choosing the directory that contains your tenant.
40
-
3. Choose **All services** in the top-left corner of the Azure portal, and then search for and select **Azure AD B2C**.
41
-
4. Select **Applications**, and then select the *webapp1* application.
42
-
5. Under **Reply URL**, add `https://localhost:44316`.
43
-
6. Select **Save**.
44
-
7. On the properties page, record the application ID that you'll use when you configure the web application.
45
-
8. Select **Keys**, select **Generate key**, and select **Save**. Record the key that you'll use when you configure the web application.
39
+
1. Make sure you're using the directory that contains your Azure AD B2C tenant by selecting the **Directory + subscription** filter in the top menu and choosing the directory that contains your tenant.
40
+
1. Choose **All services** in the top-left corner of the Azure portal, and then search for and select **Azure AD B2C**.
41
+
1. Select **Applications**, and then select the *webapp1* application.
42
+
1. Under **Reply URL**, add `https://localhost:44316`.
43
+
1. Select **Save**.
44
+
1. On the properties page, record the application ID that you'll use when you configure the web application.
45
+
1. Select **Keys**, select **Generate key**, and select **Save**. Record the key that you'll use when you configure the web application.
The following two projects are in the sample solution:
56
56
57
-
-**TaskWebApp** - Create and edit a task list. The sample uses the **sign-up or sign-in** user flow to sign up and sign in users.
58
-
-**TaskService** - Supports the create, read, update, and delete task list functionality. The API is protected by Azure AD B2C and called by TaskWebApp.
57
+
***TaskWebApp** - Create and edit a task list. The sample uses the **sign-up or sign-in** user flow to sign up and sign in users.
58
+
***TaskService** - Supports the create, read, update, and delete task list functionality. The API is protected by Azure AD B2C and called by TaskWebApp.
59
59
60
60
You change the sample to use the application that's registered in your tenant, which includes the application ID and the key that you previously recorded. You also configure the user flows that you created. The sample defines the configuration values as settings in the *Web.config* file.
61
61
62
62
Update the settings in the Web.config file to work with your user flow:
63
63
64
64
1. Open the **B2C-WebAPI-DotNet** solution in Visual Studio.
65
65
1. In the **TaskWebApp** project, open the **Web.config** file.
66
-
1.Replace the value of `ida:Tenant` and `ida:AadInstance` with the name of the tenant that you created.
66
+
1.Update the value of `ida:Tenant` and `ida:AadInstance` with the name of the Azure AD B2C tenant that you created. For example, replace `fabrikamb2c` with `contoso`.
67
67
1. Replace the value of `ida:ClientId` with the application ID that you recorded.
68
68
1. Replace the value of `ida:ClientSecret` with the key that you recorded. You must XML-encode the client secret before adding it to your Web.config.
69
69
1. Replace the value of `ida:SignUpSignInPolicyId` with `b2c_1_signupsignin1`.
@@ -73,19 +73,21 @@ Update the settings in the Web.config file to work with your user flow:
73
73
## Run the sample
74
74
75
75
1. In Solution Explorer, right-click the **TaskWebApp** project, and then click **Set as StartUp Project**.
76
-
2. Press **F5**. The default browser launches to the local web site address `https://localhost:44316/`.
76
+
1. Press **F5**. The default browser launches to the local web site address `https://localhost:44316/`.
77
77
78
78
### Sign up using an email address
79
79
80
-
1.Click**Sign up / Sign in** to sign up as a user of the application. The **b2c_1_signupsignin1** user flow is used.
81
-
2. Azure AD B2C presents a sign-in page with a sign-up link. Since you don't have an account yet, select **Sign up now**. The sign-up workflow presents a page to collect and verify the user's identity using an email address. The sign-up workflow also collects the user's password and the requested attributes defined in the user flow.
82
-
3. Use a valid email address and validate using the verification code. Set a password. Enter values for the requested attributes.
80
+
1.Select**Sign up / Sign in** to sign up as a user of the application. The **b2c_1_signupsignin1** user flow is used.
81
+
1. Azure AD B2C presents a sign-in page with a sign-up link. Since you don't have an account yet, select **Sign up now**. The sign-up workflow presents a page to collect and verify the user's identity using an email address. The sign-up workflow also collects the user's password and the requested attributes defined in the user flow.
82
+
1. Use a valid email address and validate using the verification code. Set a password. Enter values for the requested attributes.
83
83
84
84

85
85
86
-
4. Click**Create** to create a local account in the Azure AD B2C tenant.
86
+
1. Select**Create** to create a local account in the Azure AD B2C tenant.
87
87
88
-
Now the user can use their email address to sign in and use the web application.
88
+
The application user can now use their email address to sign in and use the web application.
89
+
90
+
However, the **To-Do List** feature won't function until you complete the next tutorial in the series, [Tutorial: Use Azure AD B2C to protect an ASP.NET web API](active-directory-b2c-tutorials-web-api.md).
89
91
90
92
## Next steps
91
93
@@ -96,5 +98,7 @@ In this tutorial, you learned how to:
96
98
> * Configure the sample to use the application
97
99
> * Sign up using the user flow
98
100
101
+
Now move on to the next tutorial to enable the **To-Do List** feature of the web application. In it, you register a web API application in your own Azure AD B2C tenant, and then modify the code sample to use your tenant for API authentication.
102
+
99
103
> [!div class="nextstepaction"]
100
-
> [Tutorial: Use Azure Active Directory B2C to protect an ASP.NET web API](active-directory-b2c-tutorials-web-api.md)
104
+
> [Tutorial: Use Azure Active Directory B2C to protect an ASP.NET web API >](active-directory-b2c-tutorials-web-api.md)
0 commit comments