ASP.NET Core contains middleware to support Google's OAuth 2.0 authentication workflow. This package was built from the source code at https://github.com/dotnet/dotnet/tree/87bc0b04e21d786669142109a5128c95618b75ed
$ dotnet add package Microsoft.AspNetCore.Authentication.GoogleMicrosoft.AspNetCore.Authentication.Google contains middleware to support Google's OAuth 2.0 authentication workflow.
To use Microsoft.AspNetCore.Authentication.Google, follow these steps:
dotnet add package Microsoft.AspNetCore.Authentication.Google
Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAuthentication().AddGoogle(googleOptions =>
{
googleOptions.ClientId = builder.Configuration["Authentication:Google:ClientId"];
googleOptions.ClientSecret = builder.Configuration["Authentication:Google:ClientSecret"];
});
The main types provided by this package are:
GoogleOptions: Represents the options for configuring Google authenticationGoogleHandler: The authentication handler responsible for processing Google authentication requests and generating the appropriate authentication ticketFor additional documentation and examples, refer to the official documentation on Google login setup in ASP.NET Core.
Microsoft.AspNetCore.Authentication.Google is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.