[V] This issue is not security related and can safely be disclosed publicly on GitHub
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
Unity Editor Version: 2022.3.12f1
Unity SDK Version: 16.0.2
Installation Platform & Verison: IOS version 17.1.1
Goals
What do you want to achieve?
I want to be able, using the Facebook SDK in Unity Editor, be able to sign in to my Facebook account, using the access token, and retrieve the profile picture and save it as player picture in the game
I want to be able, using Facebook SDK, to make an iOS build, and when pressing the sing in with facebook button, connect my account and retrieve profile picture and save it as player picture in the game
What do you expect to happen?
I can see the player picture being changed to the profile picture of the facebook user
What actually happened? Can you provide a stack trace?
I've passed the query: "me?fields=id,picture"
but the result.Texture returned an empty grey texture.
I've passed the query: "me?fields=id,picture"
and using webrequest, and the url returned an error HTTP/1.1 404 not found
What are the steps necessary to reproduce this issue?
This is the code for result.Texutre:
private void RequestFacebookUserData()
{
FB.API("me?fields=id,picture", HttpMethod.GET, HandleProfilePhotoCallback);
}
private void HandleProfilePhotoCallback(IGraphResult result)
{
if (!string.IsNullOrEmpty(result.Error))
{
Debug.Log($"result error is {result.Error};
return;
}
if (result.Texture == null) return;
var pictureTexture = result.Texture;
previewTextureImage.texture = pictureTexture;
}
This is the code for webrequest:
private void RequestFacebookUserData()
{
FB.API("me?fields=id,picture", HttpMethod.GET, HandlePictureCallback);
}
private void HandlePictureCallback(IGraphResult result)
{
var userProfile = result.ResultDictionary;
Debug.Log($"Full response {result.RawResult}");
var pictureData = (userProfile["picture"] as IDictionary<string, object>)["data"] as IDictionary<string, object>;
var pictureUrl = pictureData["url"] as string;
StartCoroutine(DownloadProfilePicture(pictureUrl));
}
private IEnumerator DownloadProfilePicture(string url)
{
using (UnityWebRequest uwr = UnityWebRequest.Get(url))
{
yield return uwr.SendWebRequest();
if (uwr.result != UnityWebRequest.Result.Success)
{
Debug.Log(uwr.error);
}
else
{
var text = uwr.downloadHandler.text;
Debug.Log(text);
}
}
}
this is the grey texute:
More things I've tried:
I've tried running the Facebook SDK/Examples/Mobile/GrapthRequest scene, with the LogView scene added to the build settings and this didn't do anything in the Editor - this is the GameView:
its not possible to request anything. Is this example scene only works in a build?
Another details, the App was added to the developers account but is not live. From the iOS build I was able to login with my account, but not see the accounts' picture, like in registered (live) games, from AppStore.
Should my app be "Live" and on AppStore, to be able to access the profile picture?
Checklist
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
2022.3.12f1
16.0.2
IOS
version17.1.1
Goals
What do you want to achieve?
I want to be able, using the Facebook SDK in Unity Editor, be able to sign in to my Facebook account, using the access token, and retrieve the profile picture and save it as player picture in the game
I want to be able, using Facebook SDK, to make an iOS build, and when pressing the sing in with facebook button, connect my account and retrieve profile picture and save it as player picture in the game
What do you expect to happen?
I can see the player picture being changed to the profile picture of the facebook user
What actually happened? Can you provide a stack trace?
I've passed the query: "me?fields=id,picture" but the result.Texture returned an empty grey texture.
I've passed the query: "me?fields=id,picture" and using webrequest, and the url returned an error HTTP/1.1 404 not found
What are the steps necessary to reproduce this issue?
This is the code for result.Texutre:
This is the code for webrequest:
this is the grey texute:
More things I've tried: I've tried running the Facebook SDK/Examples/Mobile/GrapthRequest scene, with the LogView scene added to the build settings and this didn't do anything in the Editor - this is the GameView:
its not possible to request anything. Is this example scene only works in a build? Another details, the App was added to the developers account but is not live. From the iOS build I was able to login with my account, but not see the accounts' picture, like in registered (live) games, from AppStore. Should my app be "Live" and on AppStore, to be able to access the profile picture?
Thanks for any help.