- Home /
Unity Facebook 400 Bad Request
I using following code to get user data from facebook
IEnumerator UserFBDataGet(string accessTkn)
{
var downloader3 = new WWW ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
//Application.OpenURL ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
yield return downloader3;
print(" downloader3.text ="+downloader3.text );
if(downloader3.error == null)
{
print(" downloader3.text ="+downloader3.text );
}
else
{
print(" downloader3.error ="+downloader3.error );
}
}
Even i use WWWForm same error is showing
IEnumerator UserFBDataGet(string accessTkn)
{
userDataGetUrl = "https://graph.facebook.com/me?";
WWWForm wf = new WWWForm();
wf.AddField ("fields","id,name,email") ;
wf.AddField ("access_token",accessTkn) ;
WWW downloader3 = new WWW(userDataGetUrl,wf) ;
yield return downloader3;
print(" downloader3.text ="+downloader3.text );
if(downloader3.error == null)
{
print(" downloader3.text ="+downloader3.text );
}
else
{
print(" downloader3.error ="+downloader3.error );
}
}
But when I call
Application.OpenURL ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
in that page i get all data properly.
It showing Error
You are trying to load data from a www stream which had the following error when downloading. 400 Bad Request UnityEngine.WWW:get_text() c__Iterator1:MoveNext() (at Assets/FBDesktopManager.cs:126)
You are trying to load data from a www stream which had the following error when downloading. 400 Bad Request UnityEngine.WWW:get_text() c__Iterator6:MoveNext() (at Assets/Scripts/FBDesktopManager.cs:91)
Is there any way that you could paste the complete error from the request executed?. Have you tried to deploy the game as web game and run a sniffer (like fiddler) to get the error detail? WWW executes a GET request and WWWForm executes POST request. WWW would be enough to get the request.
Your answer
Follow this Question
Related Questions
POST request using WWW class. error: necessary data rewind wasn't possible 2 Answers
Post image to facebook wall 0 Answers
WWW, WWWForm and SoundCloud 1 Answer
Post Reqest with dictionary 1 Answer