4
I am implementing authentication by facebook and wanted to, when entering the application with the account data, save also full name, photo, among other data.
Searching, I got the following code:
facebookOptions.Events = new Microsoft.AspNetCore.Authentication.OAuth.OAuthEvents
{
OnCreatingTicket = context => {
string surName = context.User.Value<string>("last_name");
context.Identity.AddClaim(new System.Security.Claims.Claim(ClaimTypes.Surname, surName));
return Task.FromResult(0);
}
};
The user’s last name appears in the variable surName
but you won’t be safe anywhere.
If anyone can help me understand what it is Identity.AddClaim
and how to save the data that comes in User.Value<T>
. Thank you