'Sharing screenshot with text to facebook unity

I'm trying to give the user the possibility to post a screenshot of his game on facebook with the dowload link of the game.

I've looked a bit and it seemed it would be possible with FB.API, but I can't manage to make it work. Aparently you need a permission but I can't to find which permission and how to give it.

I'm using unity 2020.3.21f1

Here is what I'm doing for now

public void ShareScreenShot(Texture2D screenShot)
{
    byte[] encodedScreenShot = screenShot.EncodeToPNG();

    var wwwForm = new WWWForm();
    wwwForm.AddBinaryData("image", encodedScreenShot, "ScreenShot.png");
    wwwForm.AddField("message", "Venez me défier : https://randomlink.blablabla");

    FB.API("me/photos", HttpMethod.POST, ShareScreenShotCallback, wwwForm);
}

void ShareScreenShotCallback(IResult result)
{
    if (result.Error != null)
    {
        Debug.Log(result.Error);
    }
    else
    {
        Debug.Log("sharing success");
    }
}

If anyone of you knows how it can be done, it would be of great help, thanks



Solution 1:[1]

I suppose you need to login to facebook with custom permissions, because the default one only allows you to send invitations to choosen friends.

https://developers.facebook.com/docs/unity/reference/current/FB.LogInWithPublishPermissions/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pawe? ??gowski