I am implementing facebook authentication and wanted to, when entering the application with the account data, also save 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 surname appears in the variable surName
but is not saved anywhere.
If someone can help me understand what is Identity.AddClaim
and how to save the data that comes in User.Value<T>
. Thanks