Fix bad merge, replace social SVGs with single PNG
parent
a4a7be2f7c
commit
c52dd2ec12
|
@ -19,10 +19,7 @@ This tutorial will demonstrate how to build an ASP.NET Core app that enables use
|
|||
|
||||
[Facebook](facebook-logins.md), [Twitter](twitter-logins.md), [Google](google-logins.md), and [Microsoft](microsoft-logins.md) providers are available out-of-the-box and will be covered in the following sections. Many third-party packages such as the ones by [aspnet-contrib](https://www.nuget.org/packages?q=owners%3Aaspnet-contrib+title%3AOAuth) facilitate the use of other providers not covered here, including GitHub, LinkedIn, Reddit, and so on.
|
||||
|
||||
<img src="sociallogins/_static/facebook.svg" width="24">
|
||||
<img src="sociallogins/_static/twitter.svg" width="24">
|
||||
<img src="sociallogins/_static/google.svg" width="24">
|
||||
<img src="sociallogins/_static/microsoft.svg" width="24">
|
||||
![image](sociallogins/_static/social.png)
|
||||
|
||||
Enabling users to login with their existing credentials is convenient for the users and shifts many of the complexities of managing the sign-in process onto a third party. For examples of how social logins can drive traffic and customer conversions, see case studies by [Facebook](https://developers.facebook.com/case-studies) and [Twitter](https://developers.facebook.com/case-studies/).
|
||||
|
||||
|
@ -73,61 +70,8 @@ services.AddMvc(options =>
|
|||
|
||||
The template used to create the sample project in this tutorial has code in `Startup.cs` which reads the configuration values from a secret store:
|
||||
|
||||
````csharp
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
builder.AddUserSecrets();
|
||||
}
|
||||
````
|
||||
|
||||
* Install the [Secret Manager tool](../app-secrets.md).
|
||||
|
||||
* Set the Facebook AppId:
|
||||
|
||||
<!-- literal_block {"ids": [], "xml:space": "preserve"} -->
|
||||
|
||||
````
|
||||
dotnet user-secrets set Authentication:Facebook:AppId <app-Id>
|
||||
````
|
||||
|
||||
* Set the Facebook AppSecret:
|
||||
|
||||
<!-- literal_block {"ids": [], "xml:space": "preserve"} -->
|
||||
|
||||
````
|
||||
dotnet user-secrets set Authentication:Facebook:AppSecret <app-secret>
|
||||
````
|
||||
|
||||
The following code reads the configuration values stored by the [Secret Manager](../app-secrets.md#security-app-secrets).
|
||||
|
||||
[!code-csharp[Main](../../common/samples/WebApplication1/Startup.cs?highlight=11&range=20-36)]
|
||||
|
||||
## Enable Facebook middleware
|
||||
|
||||
**Note:** You will need to use NuGet to install the Microsoft.AspNetCore.Authentication.Facebook package if it hasn't already been installed.
|
||||
|
||||
Add the Facebook middleware in the `Configure` method in `Startup`:
|
||||
|
||||
[!code-csharp[Main](./sociallogins/sample/Startup.cs?highlight=21,22,23,24,25&range=64-96)]
|
||||
|
||||
## Login with Facebook
|
||||
|
||||
Run your application and click Login. You will see an option for Facebook.
|
||||
|
||||
![image](sociallogins/_static/FBLogin1.PNG)
|
||||
|
||||
When you click on Facebook, you will be redirected to Facebook for authentication.
|
||||
|
||||
![image](sociallogins/_static/FBLogin2.PNG)
|
||||
|
||||
Once you enter your Facebook credentials, then you will be redirected back to the Web site where you can set your email.
|
||||
|
||||
You are now logged in using your Facebook credentials.
|
||||
|
||||
![image](sociallogins/_static/DoneFacebook.PNG)
|
||||
|
||||
## Optionally set password
|
||||
|
||||
As a best practice, it is not recommended to store the secrets in a configuration file in the application since they can be checked into source control which may be publicly accessible.
|
||||
|
||||
The **SecretManager** tool will store sensitive application settings in the user profile folder on the local machine. These settings are then seamlessly merged with settings from all other sources during application startup.
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24">
|
||||
<path fill="#3563A1" d="M13.4,20.5v-8.1h2.7l0.4-3.1h-3.1v-2c0-0.9,0.3-1.5,1.6-1.5l1.7,0V3c-0.3,0-1.3-0.1-2.4-0.1
|
||||
c-2.4,0-4,1.5-4,4.2v2.3H7.4v3.1h2.7v8.1H13.4z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 345 B |
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24">
|
||||
<g fill="#DC4F42">
|
||||
<path class="st0" d="M0,12.2C0.1,8.3,3.7,4.9,7.6,5c1.9-0.1,3.7,0.7,5.1,1.9c-0.6,0.7-1.3,1.4-1.9,2C9,7.7,6.6,7.3,4.9,8.7
|
||||
c-2.5,1.7-2.6,5.8-0.2,7.6c2.3,2.1,6.7,1.1,7.3-2.2c-1.5,0-2.9,0-4.4,0c0-0.9,0-1.7,0-2.6c2.4,0,4.9,0,7.3,0c0.1,2-0.1,4.2-1.4,5.9
|
||||
c-1.9,2.7-5.7,3.4-8.7,2.3C1.9,18.6-0.2,15.4,0,12.2z"/>
|
||||
<path class="st0" d="M19.6,9.3c0.7,0,1.4,0,2.2,0c0,0.7,0,1.5,0,2.2c0.7,0,1.5,0,2.2,0c0,0.7,0,1.4,0,2.2c-0.7,0-1.4,0-2.2,0
|
||||
c0,0.7,0,1.5,0,2.2c-0.7,0-1.4,0-2.2,0c0-0.7,0-1.4,0-2.2c-0.7,0-1.5,0-2.2,0c0-0.7,0-1.4,0-2.2c0.7,0,1.4,0,2.2,0
|
||||
C19.6,10.8,19.6,10.1,19.6,9.3z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 846 B |
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24">
|
||||
<polygon fill="#7DBD42" points="11.3,5.1 20.7,3.8 20.7,12 11.3,12.1 "/>
|
||||
<polygon fill="#FDB913" points="11.3,19.9 20.7,21.2 20.7,13 11.3,12.9 "/>
|
||||
<polygon fill="#F05123" points="3.3,6.2 10.4,5.2 10.4,12.1 3.3,12.2 "/>
|
||||
<polygon fill="#399DD7" points="3.3,18.8 10.4,19.8 10.4,13 3.3,12.9 "/>
|
||||
</svg>
|
Before Width: | Height: | Size: 486 B |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24">
|
||||
<path fill="#27B4E8" d="M7.8,21.5c8.6,0,13.3-7.1,13.3-13.3c0-0.2,0-0.4,0-0.6C22,7,22.8,6.1,23.4,5.2
|
||||
c-0.8,0.4-1.7,0.6-2.7,0.7c1-0.6,1.7-1.5,2.1-2.6c-0.9,0.5-1.9,0.9-3,1.1C19,3.6,17.8,3,16.4,3c-2.6,0-4.7,2.1-4.7,4.7
|
||||
c0,0.4,0,0.7,0.1,1.1C8,8.5,4.6,6.7,2.3,3.9C1.9,4.6,1.6,5.4,1.6,6.2c0,1.6,0.8,3,2.1,3.9c-0.8,0-1.5-0.2-2.1-0.6c0,0,0,0,0,0.1
|
||||
c0,2.3,1.6,4.1,3.7,4.6c-0.4,0.1-0.8,0.2-1.2,0.2c-0.3,0-0.6,0-0.9-0.1c0.6,1.9,2.3,3.2,4.4,3.2c-1.6,1.3-3.6,2-5.8,2
|
||||
c-0.4,0-0.7,0-1.1-0.1C2.7,20.7,5.2,21.5,7.8,21.5"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 720 B |
Loading…
Reference in New Issue