hi,im using unity3d to make a game.
now i want players login/register drupal in my game.
here is my C# code:
void GetToken()
{
HTTPRequest httpReq = new HTTPRequest(new System.Uri("http://61.52.67.125:800/d/userlogin/user/token"),
HTTPMethods.Post,
OnReqFinished);
httpReq.Send();
}

void Login()
{
HTTPRequest httpReq = new HTTPRequest(new System.Uri("http://61.52.67.125:800/d/userlogin/user/login"),
HTTPMethods.Post,
OnReqFinished);
httpReq.AddHeader("X-CSRF-Token", token);
httpReq.AddHeader("Content-Type", "application/json");
JsonData data = new JsonData();
data["username"] = "admin";
data["password"] = "111111";
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
httpReq.RawData = encoding.GetBytes(data.ToJson());
httpReq.Send();
}

i got the token,but i could not login,here is the message:
Request finished Successfully, but the server sent an error. Status Code: 406-Not Acceptable : ????????? admin ???????????? Message: ["\u5df2\u7ecf\u7528 admin \u767b\u9646\u4e86\u3002"]

please help me,thank you!

Comments

VM’s picture

per: https://www.drupal.org/node/643758 please edit the post and move it to a more appropriate forum and please wrap your code in code tags for readability. Thank you.

VM’s picture

posts are not deleted from drupal.org. To move a post you must Edit the post and adjust the forum select list.