0
페이스 북을 사용할 때 사용자의 위치 (또는 지역)를 얻으려고합니다. OAuth (Google과 함께 시도하지 않았지만 내가 좋아할만한 것임)페이스 북 OAuth 공급자를 사용할 때 위치 클레임을 얻는 방법
나는 항상 같은 클레임 유형을 받고 있어요_signInManager.GetExternalLoginInfoAsync()
을 수행 할 때
app.UseFacebookAuthentication(new FacebookOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
ClientId = "",
ClientSecret = "",
Scope = {"email",
"user_friends",
"user_location" }
});
문제는, 그래서 I :
는 이미이 같은 내 시작 파일에 내 범위를 설정 한 th를 더하고 싶습니다. 지역 또는 기타 소유권 주장 유형 (예 : 이메일 대신 사용자 이름).
내가 할 때
var user = new ApplicationUser
{
ProviderKey = info.ProviderKey,
Email = info.Principal.FindFirstValue(ClaimTypes.Email),
Name = info.Principal.FindFirstValue(ClaimTypes.GivenName),
Surname = info.Principal.FindFirstValue(ClaimTypes.Surname),
AuthenticationType = info.LoginProvider,
NormalizedUserName = info.Principal.FindFirstValue(ClaimTypes.Email),
UserName = info.Principal.FindFirstValue(ClaimTypes.Email),
Location = info.Principal.FindFirstValue(ClaimTypes.Locality), // I'm getting null here
Created = DateTime.UtcNow
};
나는 내가 수집 할 그 여분의 주장에 대한 설정을 추가 할 필요가 있다고 생각하지만, 어떤 도움이 이해할 수있을 것이다을 어디서부터 시작 모르겠어요.
덕분에 내가 검토하고 –
잘 그것이 마치 마법처럼 일을 알려 드리겠습니다, 당신은 어떻게 필드 이름이 위치 알고 USER_LOCATION하지? –
https://developers.facebook.com/docs/facebook-login/permissions#reference-user_location –