I'm using Google authentication for my asp.net mvc application. I added Google to my Startup.cs class:
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = GoogleDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
})
.AddGoogle(googleOptions =>
{
googleOptions.ClientId = _configuration["Authentication:Google:ClientId"];
googleOptions.ClientSecret = _configuration["Authentication:Google:ClientSecret"];
googleOptions.SaveTokens = true;
});
I can get access_token from controller using this:
var token = await HttpContext.GetTokenAsync("access_token").ConfigureAwait(false);
I need id_token to authenticate to my custom backend application like this. I tried using this code but I get null.
var token = await HttpContext.GetTokenAsync("id_token").ConfigureAwait(false);
Is it possible to get id_token somehow?