I use .net core 7 and Microsoft.AspNetCore.Authentication.Google to use google authentication. It is ok but when I stop the program, it is not auto logout. It saves cookies on the browser.
If I want logout, I call await HttpContext.SignOutAsync();
in the controller.
How can I auto call await HttpContext.SignOutAsync();
when I stop the program?
A trick
First, I create a static variable public static int isNew = 0;
Then, I put that code to Index action in HomeController
if (TimeLife.isNew == 0)
{
await HttpContext.SignOutAsync();
TimeLife.isNew = 1;
}
It work good.
The application will auto logout in the first login