- Home /
Question is off-topic or not relevant
Get email from facebook SDK
Hello everyone,
I've been struggling with retrieving the email from facebook's SDK.
I googled but without success, has anyone did this before?
Thanks!
Your post didn't relate this to unity whatsoever. You need extended permissions to get the primary email address: https://developers.facebook.com/docs/facebook-login/permissions/v2.2
I am using this to request extended permission, it is not working. FB.Login("public_profile,user_friends,user_birthday,email", result => { });
@nventimiglia Try this:
public void Login()
{
var perms = new List<string>() { "public_profile", "email" };
FB.LogInWithReadPermissions(perms, AuthCallback);
}
void AuthCallback(ILoginResult result)
{
$$anonymous$$NP.ShowPreloader(STRINGS.PROGRESS_TITLE, STRINGS.PROGRESS_$$anonymous$$ESSAGE);
if (FB.IsLoggedIn)
{
// $$anonymous$$ake a Graph API call to get email address
FB.API("/me?fields=email", Http$$anonymous$$ethod.GET, graphResult =>
{
if (string.IsNullOrEmpty(graphResult.Error) == false)
{
Debug.Log("could not get email address");
return;
}
string email = graphResult.ResultDictionary["email"] as string;
Debug.Log(email);
});
}
else
{
Debug.Log("User cancelled login");
}
}
Follow this Question
Related Questions
social network & share function 4 Answers
Social features for iOS? 2 Answers
Facebook log in with email and password 0 Answers
How to intergrate facebook SDK with a mobile game 1 Answer
Turning off SSO on Facebook's Unity SDK for Android 0 Answers