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
By [Valeriy Novytskyy](https://github.com/01binary) and [Rick Anderson](https://twitter.com/RickAndMSFT)
15
15
16
+
<!-- per @rick-anderson and scott addie, don't update images. Remove images and point the customer to the FB set up page. FB needs to maintain instructions to get key and secret.
17
+
-->
18
+
16
19
This tutorial with code examples shows how to enable your users to sign in with their Facebook account using a sample ASP.NET Core 3.0 project created on the [previous page](xref:security/authentication/social/index). We start by creating a Facebook App ID by following the [official steps](https://developers.facebook.com).
See the [FacebookOptions](/dotnet/api/microsoft.aspnetcore.builder.facebookoptions) API reference for more information on configuration options supported by Facebook authentication. Configuration options can be used to:
90
+
* Run the app and select **Log in**.
91
+
* Under **Use another service to log in.**, select Facebook.
92
+
* You are redirected to **Facebook** for authentication.
93
+
* Enter your Facebook credentials.
94
+
* You are redirected back to your site where you can set your email.
88
95
89
-
* Request different information about the user.
90
-
* Add query string arguments to customize the login experience.
96
+
You are now logged in using your Facebook credentials:
91
97
92
-
## Sign in with Facebook
98
+
<aname="react"></a>
93
99
94
-
Run your application and click **Log in**. You see an option to sign in with Facebook.
100
+
## React to cancel authorize external sign-in
95
101
96
-

102
+
<xref:Microsoft.AspNetCore.Authentication.RemoteAuthenticationOptions.AccessDeniedPath> can provide a redirect path to the user agent when the user doesn't approve the requested authorization demand.
97
103
98
-
When you click on **Facebook**, you are redirected to Facebook for authentication:
104
+
The following code sets the `AccessDeniedPath`to `"/AccessDeniedPathInfo"`:
Once you enter your Facebook credentials you are redirected back to your site where you can set your email.
114
+
### Test AccessDeniedPath
107
115
108
-
You are now logged in using your Facebook credentials:
109
-
110
-

116
+
* Navigate to [facebook.com](https://www.facebook.com/)
117
+
* If you are signed in, you must sign out.
118
+
* Run the app and select Facebook sign-in.
119
+
* Select **Not now**. You are redirected to the specified `AccessDeniedPath` page.
111
120
121
+
<!-- End of React -->
112
122
[!INCLUDE[Forward request information when behind a proxy or load balancer section](includes/forwarded-headers-middleware.md)]
113
123
124
+
[!INCLUDE[](includes/chain-auth-providers.md)]
125
+
126
+
See the [FacebookOptions](/dotnet/api/microsoft.aspnetcore.builder.facebookoptions) API reference for more information on configuration options supported by Facebook authentication. Configuration options can be used to:
127
+
128
+
* Request different information about the user.
129
+
* Add query string arguments to customize the login experience.
130
+
114
131
## Troubleshooting
115
132
116
133
***ASP.NET Core 2.x only:** If Identity isn't configured by calling `services.AddIdentity` in `ConfigureServices`, attempting to authenticate will result in *ArgumentException: The 'SignInScheme' option must be provided*. The project template used in this tutorial ensures that this is done.
Copy file name to clipboardExpand all lines: aspnetcore/security/authentication/social/microsoft-logins.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ If you don't have a Microsoft account, select **Create one**. After signing in,
23
23
24
24
* Select **New registration**
25
25
* Enter a **Name**.
26
-
* Select an option for **Supported account types**. <!-- Accounts for any org work with MS domain accounts. Most folks probably want the last option, personal MS accounts -->
26
+
* Select an option for **Supported account types**. <!-- Accounts for any org work with MS domain accounts. Most folks probably want the last option, personal MS accounts. It took 24 hours after setting this up for the keys to work-->
27
27
* Under **Redirect URI**, enter your development URL with `/signin-microsoft` appended. For example, `https://localhost:5001/signin-microsoft`. The Microsoft authentication scheme configured later in this sample will automatically handle requests at `/signin-microsoft` route to implement the OAuth flow.
28
28
* Select **Register**
29
29
@@ -37,8 +37,7 @@ If you don't have a Microsoft account, select **Create one**. After signing in,
37
37
38
38
* Under **Client secrets**, copy the value of the client secret.
39
39
40
-
> [!NOTE]
41
-
> The URI segment `/signin-microsoft` is set as the default callback of the Microsoft authentication provider. You can change the default callback URI while configuring the Microsoft authentication middleware via the inherited [RemoteAuthenticationOptions.CallbackPath](/dotnet/api/microsoft.aspnetcore.authentication.remoteauthenticationoptions.callbackpath) property of the [MicrosoftAccountOptions](/dotnet/api/microsoft.aspnetcore.authentication.microsoftaccount.microsoftaccountoptions) class.
40
+
The URI segment `/signin-microsoft` is set as the default callback of the Microsoft authentication provider. You can change the default callback URI while configuring the Microsoft authentication middleware via the inherited [RemoteAuthenticationOptions.CallbackPath](/dotnet/api/microsoft.aspnetcore.authentication.remoteauthenticationoptions.callbackpath) property of the [MicrosoftAccountOptions](/dotnet/api/microsoft.aspnetcore.authentication.microsoftaccount.microsoftaccountoptions) class.
42
41
43
42
## Store the Microsoft client ID and secret
44
43
@@ -62,8 +61,6 @@ Add the Microsoft Account service to the `Startup.ConfigureServices`:
For more information about configuration options supported by Microsoft Account authentication, see the [MicrosoftAccountOptions](/dotnet/api/microsoft.aspnetcore.builder.microsoftaccountoptions) API reference. This can be used to request different information about the user.
68
65
69
66
## Sign in with Microsoft Account
@@ -74,6 +71,8 @@ Tap **Yes** and you will be redirected back to the web site where you can set yo
74
71
75
72
You are now logged in using your Microsoft credentials:
76
73
74
+
[!INCLUDE[](includes/chain-auth-providers.md)]
75
+
77
76
[!INCLUDE[Forward request information when behind a proxy or load balancer section](includes/forwarded-headers-middleware.md)]
Copy file name to clipboardExpand all lines: aspnetcore/security/authentication/social/twitter-logins.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,12 @@ You are now logged in using your Twitter credentials:
73
73
74
74
[!INCLUDE[Forward request information when behind a proxy or load balancer section](includes/forwarded-headers-middleware.md)]
75
75
76
+
<!--
77
+
### React to cancel Authorize External sign-in
78
+
Twitter doesn't support AccessDeniedPath
79
+
Rather in the twitter setup, you can provide an External sign-in homepage. The external sign-in homepage doesn't support localhost. Tested with https://cors3.azurewebsites.net/ and that works.
80
+
-->
81
+
76
82
## Troubleshooting
77
83
78
84
* **ASP.NET Core 2.x only:** If Identity isn't configured by calling `services.AddIdentity` in `ConfigureServices`, attempting to authenticate will result in *ArgumentException: The 'SignInScheme' option must be provided*. The project template used in this sample ensures that this is done.
0 commit comments