public static FacebookCreateUserResponse CreateFacebookUser(string facebookAppId, string facebookAppSecret)
{
var accessToken = GetFacebookAccessToken(facebookAppId, facebookAppSecret);
FacebookCreateUserResponse responseObject;
// Create an user for the app. This returns the OAuth token.
// https://developers.facebook.com/docs/test_users/
var facebookCreateNewUserUrl = string.Format(
@"https://graph.facebook.com/{0}/accounts/test-users?
installed=true&name=Foo%20Bar&locale=en_US&permissions=read_stream&method=post&{1}",
facebookAppId,
accessToken);
var createUserRequest = new UnityWwwRequest(new Uri(facebookCreateNewUserUrl));
var createUserResponse = createUserRequest.GetResponse();
using (var streamReader = new StreamReader(createUserResponse.ResponseBody.OpenResponse()))
{
var json = ThirdParty.Json.LitJson.JsonMapper.ToObject(streamReader);
responseObject = new FacebookCreateUserResponse(json);
}
return responseObject;
}