diff --git a/aspnetcore/security/authentication/social/facebook-logins.md b/aspnetcore/security/authentication/social/facebook-logins.md index 092fac510b14..9e1f6b8569c5 100644 --- a/aspnetcore/security/authentication/social/facebook-logins.md +++ b/aspnetcore/security/authentication/social/facebook-logins.md @@ -18,7 +18,7 @@ uid: security/authentication/facebook-logins By [Valeriy Novytskyy](https://github.com/01binary) and [Rick Anderson](https://twitter.com/RickAndMSFT) -This tutorial shows you how to enable your users to sign in with their Facebook account using a sample ASP.NET Core 2.x project created on the [previous page](index.md). We start by creating a Facebook App ID by following the [official steps](https://developers.facebook.com/docs/apps/register). +This tutorial shows you how to enable your users to sign in with their Facebook account using a sample ASP.NET Core 2.0 project created on the [previous page](index.md). We start by creating a Facebook App ID by following the [official steps](https://developers.facebook.com/docs/apps/register). ## Create the app in Facebook @@ -62,26 +62,40 @@ Link sensitive settings like Facebook `App ID` and `App Secret` to your applicat ## Configure Facebook middleware -> [!NOTE] -> The project template used in this tutorial ensures that -[Microsoft.AspNetCore.Authentication.Facebook](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Facebook) package is already installed. -> -> * To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. -> * To install with **dotnet** CLI, execute the following in your project directory: -> -> `dotnet add package Microsoft.AspNetCore.Authentication.Facebook` +The project template used in this tutorial ensures that [Microsoft.AspNetCore.Authentication.Facebook](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Facebook) package is already installed. -Add the Facebook middleware in the `ConfigureServices` method in the *Startup.cs* file: +* To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. +* To install with **dotnet** CLI, execute the following in your project directory: + + `dotnet add package Microsoft.AspNetCore.Authentication.Facebook` + +# [ASP.NET Core 1.x](#tab/aspnet1x) + +Add the Facebook middleware in the `Configure` method in `Startup.cs` file: + +```csharp +app.UseFacebookAuthentication(new FacebookOptions() +{ + AppId = Configuration["Authentication:Facebook:AppId"], + AppSecret = Configuration["Authentication:Facebook:AppSecret"] +}); +``` + +# [ASP.NET Core 2.0](#tab/aspnet20) + +Add the Facebook middleware in the `ConfigureServices` method in the `Startup.cs` file: ```csharp -services.AddFacebookAuthentication(facebookOptions => +services.AddFacebookAuthentication(new FacebookOptions() { - facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"]; - facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"]; + AppId = Configuration["Authentication:Facebook:AppId"]; + AppSecret = Configuration["Authentication:Facebook:AppSecret"]; }); ``` -Note: See the [FacebookOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Facebook/FacebookOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Facebook middleware. Configuration options can be used to: +--- + +See the [FacebookOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Facebook/FacebookOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Facebook middleware. Configuration options can be used to: * Request different information about the user. * Add query string arguments to customize the login experience. diff --git a/aspnetcore/security/authentication/social/google-logins.md b/aspnetcore/security/authentication/social/google-logins.md index df2c160f7380..450dda5474e9 100644 --- a/aspnetcore/security/authentication/social/google-logins.md +++ b/aspnetcore/security/authentication/social/google-logins.md @@ -17,7 +17,7 @@ uid: security/authentication/google-logins By [Valeriy Novytskyy](https://github.com/01binary) and [Rick Anderson](https://twitter.com/RickAndMSFT) -This tutorial shows you how to enable your users to sign in with their Google+ account using a sample ASP.NET Core 2.x project created on the [previous page](index.md). We start by following the [official steps](https://developers.google.com/identity/sign-in/web/devconsole-project) to create a new app in Google API Console. +This tutorial shows you how to enable your users to sign in with their Google+ account using a sample ASP.NET Core 2.0 project created on the [previous page](index.md). We start by following the [official steps](https://developers.google.com/identity/sign-in/web/devconsole-project) to create a new app in Google API Console. ## Create the app in Google API Console @@ -84,25 +84,40 @@ The values for these tokens can be found in the JSON file downloaded in the prev ## Configure Google middleware -Note: The project template used in this tutorial ensures that -[Microsoft.AspNetCore.Authentication.Google](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Google) package is installed. +The project template used in this tutorial ensures that [Microsoft.AspNetCore.Authentication.Google](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Google) package is installed. * To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. * To install with **dotnet** CLI, execute the following in your project directory: `dotnet add package Microsoft.AspNetCore.Authentication.Google` -Add the Google middleware in the `ConfigureServices` method in `Startup.cs`: +# [ASP.NET Core 1.x](#tab/aspnet1x) + +Add the Google middleware in the `Configure` method in `Startup.cs` file: + +```csharp +app.UseGoogleAuthentication(new GoogleOptions() +{ + ClientId = Configuration["Authentication:Google:ClientId"], + ClientSecret = Configuration["Authentication:Google:ClientSecret"] +}); +``` + +# [ASP.NET Core 2.0](#tab/aspnet20) + +Add the Google middleware in the `ConfigureServices` method in `Startup.cs` file: ```csharp -services.AddGoogleAuthentication(googleOptions => +services.AddGoogleAuthentication(new GoogleOptions() { - googleOptions.ClientId = Configuration["Authentication:Google:ClientId"]; - googleOptions.ClientSecret = Configuration["Authentication:Google:ClientSecret"]; + ClientId = Configuration["Authentication:Google:ClientId"]; + ClientSecret = Configuration["Authentication:Google:ClientSecret"]; }); ``` -Note: See the [GoogleOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Google/GoogleOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Google middleware. This can be used to request different information about the user. +--- + +See the [GoogleOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Google/GoogleOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Google middleware. This can be used to request different information about the user. ## Sign in with Google diff --git a/aspnetcore/security/authentication/social/microsoft-logins.md b/aspnetcore/security/authentication/social/microsoft-logins.md index efbd4281f95e..61178411a0aa 100644 --- a/aspnetcore/security/authentication/social/microsoft-logins.md +++ b/aspnetcore/security/authentication/social/microsoft-logins.md @@ -18,7 +18,7 @@ uid: security/authentication/microsoft-logins By [Valeriy Novytskyy](https://github.com/01binary) and [Rick Anderson](https://twitter.com/RickAndMSFT) -This tutorial shows you how to enable your users to sign in with their Microsoft account using a sample ASP.NET Core 2.x project created on the [previous page](index.md). +This tutorial shows you how to enable your users to sign in with their Microsoft account using a sample ASP.NET Core 2.0 project created on the [previous page](index.md). ## Create the app in Microsoft Developer Portal @@ -66,29 +66,41 @@ Link sensitive settings like Microsoft `Application ID` and `Password` to your a ## Configure Microsoft Account middleware -> [!NOTE] -> The project template used in this tutorial ensures that +The project template used in this tutorial ensures that [Microsoft.AspNetCore.Authentication.Microsoft](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Microsoft) package is already installed. -> -> * To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. -> * To install with **dotnet** CLI, execute the following in your project directory: -> -> `dotnet add package Microsoft.AspNetCore.Authentication.Microsoft` -Add the Microsoft Account middleware in the `ConfigureServices` method in `Startup.cs`: +* To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. +* To install with **dotnet** CLI, execute the following in your project directory: + + `dotnet add package Microsoft.AspNetCore.Authentication.Microsoft` + +# [ASP.NET Core 1.x](#tab/aspnet1x) + +Add the Microsoft Account middleware in the `Configure` method in `Startup.cs` file: ```csharp -services.AddMicrosoftAuthentication(microsoftOptions => +app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions() { - microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ApplicationId"]; - microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:Password"]; + ClientId = Configuration["Authentication:Microsoft:ApplicationId"], + ClientSecret = Configuration["Authentication:Microsoft:Password"] }); ``` -> [!NOTE] -> Although the terminology used on Microsoft Developer Portal names these tokens `ApplicationId` and `Password`, they are exposed as `ClientId` and `ClientSecret` to the configuration API. -> [!NOTE] -> See the [MicrosoftOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Microsoft/MicrosoftOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Microsoft Account middleware. This can be used to request different information about the user. +# [ASP.NET Core 2.0](#tab/aspnet20) + +Add the Microsoft Account middleware in the `ConfigureServices` method in `Startup.cs` file: + +```csharp +services.AddMicrosoftAuthentication(new MicrosoftAccountOptions() +{ + ClientId = Configuration["Authentication:Microsoft:ApplicationId"]; + ClientSecret = Configuration["Authentication:Microsoft:Password"]; +}); +``` + +Although the terminology used on Microsoft Developer Portal names these tokens `ApplicationId` and `Password`, they are exposed as `ClientId` and `ClientSecret` to the configuration API. + +See the [MicrosoftOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Microsoft/MicrosoftOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Microsoft Account middleware. This can be used to request different information about the user. ## Sign in with Microsoft Account diff --git a/aspnetcore/security/authentication/social/twitter-logins.md b/aspnetcore/security/authentication/social/twitter-logins.md index 919f483c1211..f8e37bcbcd4d 100644 --- a/aspnetcore/security/authentication/social/twitter-logins.md +++ b/aspnetcore/security/authentication/social/twitter-logins.md @@ -18,7 +18,7 @@ uid: security/authentication/twitter-logins By [Valeriy Novytskyy](https://github.com/01binary) and [Rick Anderson](https://twitter.com/RickAndMSFT) -This tutorial shows you how to enable your users to [sign in with their Twitter account](https://dev.twitter.com/web/sign-in/desktop-browser) using a sample ASP.NET Core 2.x project created on the [previous page](index.md). +This tutorial shows you how to enable your users to [sign in with their Twitter account](https://dev.twitter.com/web/sign-in/desktop-browser) using a sample ASP.NET Core 2.0 project created on the [previous page](index.md). ## Create the app in Twitter @@ -48,27 +48,40 @@ These tokens can be found on the **Keys and Access Tokens** tab after creating y ## Configure Twitter middleware -> [!NOTE] -> The project template used in this tutorial ensures that -[Microsoft.AspNetCore.Authentication.Twitter](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Twitter) package is already installed. -> -> * To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. -> * To install with **dotnet** CLI, execute the following in your project directory: -> -> `dotnet add package Microsoft.AspNetCore.Authentication.Twitter` +The project template used in this tutorial ensures that [Microsoft.AspNetCore.Authentication.Twitter](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Twitter) package is already installed. -Add the Twitter middleware in the `ConfigureServices` method in `Startup.cs`: +* To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**. +* To install with **dotnet** CLI, execute the following in your project directory: + + `dotnet add package Microsoft.AspNetCore.Authentication.Twitter` + +# [ASP.NET Core 1.x](#tab/aspnet1x) + +Add the Twitter middleware in the `Configure` method in `Startup.cs` file: + +```csharp +app.UseTwitterAuthentication(new TwitterOptions() +{ + ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"], + ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"] +}); +``` + +# [ASP.NET Core 2.0](#tab/aspnet20) + +Add the Twitter middleware in the `ConfigureServices` method in `Startup.cs` file: ```csharp -services.AddTwitterAuthentication(twitterOptions => +services.AddTwitterAuthentication(new TwitterOptions() { - twitterOptions.ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"]; - twitterOptions.ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"]; + ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"]; + ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"]; }); ``` -> [!NOTE] -> See the [TwitterOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Twitter/TwitterOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Twitter middleware. This can be used to request different information about the user. +--- + +See the [TwitterOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Twitter/TwitterOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Twitter middleware. This can be used to request different information about the user. ## Sign in with Twitter