Home > Enterprise >  Confusion about Google OAuth packages in ASP.NET Core
Confusion about Google OAuth packages in ASP.NET Core

Time:09-27

I need to access some Google APIs (via Google.Apis.* NuGet Packages). Therefore I need to use the Google.Apis.Auth.AspNetCore package as described in the official documentation:

services
    .AddAuthentication(o =>
    {
        o.DefaultChallengeScheme = GoogleOpenIdConnectDefaults.AuthenticationScheme;
        o.DefaultForbidScheme = GoogleOpenIdConnectDefaults.AuthenticationScheme;
        o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    })
    .AddGoogleOpenIdConnect(options =>
    {
        options.ClientId = googleClientId;
        options.ClientSecret = googleClientSecret;
    });

On the other hand, I use classical ASP.NET Core Identity, especially the Google external login setup using the Microsoft.AspNetCore.Authentication.Google NuGet package which is initialized like this:

services
    .AddAuthentication()
    .AddGoogle(options =>
    {
        options.ClientId = googleClientId;
        options.ClientSecret = googleClientSecret;
    });

Is there a way to share the OAuth configurations, logins, ...?

  • Related