Hi,
I am trying to make a project in ASP.NET 5 MVC 6 and using Facebook External Login. Everything is working fine in the default template.
I want to capture Gender information which is available in "public_profile" permission.
In MVC 5 I was able to do it through Provider OnAuthentication method as shown in the below code which I am not able to find its equivalent in MVC 6:
var facebookAuthOptions = new FacebookAuthenticationOptions(); facebookAuthOptions.AppId = "..."; //Enter your AppId facebookAuthOptions.AppSecret = "..."; //Enter your AppSecret facebookAuthOptions.Provider = new FacebookAuthenticationProvider() { OnAuthenticated = async context => { context.Identity.AddClaim(new System.Security.Claims.Claim("FacebookAccessToken", context.AccessToken)); foreach (var claim in context.User) { var claimType = string.Format("urn:facebook:{0}", claim.Key); string claimValue = claim.Value.ToString(); if (!context.Identity.HasClaim(claimType, claimValue)) context.Identity.AddClaim(new System.Security.Claims.Claim(claimType, claimValue, "XmlSchemaString", "Facebook")); } } };
I tried to find OnAuthentication method in Identity3 but could not find it.
Can anyone please help me with the same as I am trying to retrieve the following information: Gender, FirstName, LastName which is available through public_profile scope.