When trying to login with google i will be signed-in to the homepage but when trying to get the fields in the db table I always get null. I found below code from stockoverflow but I don't know where to put the code?
You can fix this by either switchting to the ClaimTypes.NameIdentifier:
new ClaimsIdentity(new[]
{
new Claim(ClaimTypes.Name, user.UserName),
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
})
Or you configure Identity properly so it will use your UserID claim type:
// in Startup.ConfigureServices
services.AddIdentity(options => {
options.ClaimsIdentity.UserIdClaimType = "UserID";
});
in vs2022 there is no Startup.ConfigureServices page so how to configure that?
Is signed-in doesn't mean that the user is authenticated? Why the problem is only for the users that logs in with google account!