Closed geff closed 11 years ago
Sadly, it is impossible.
Unity3D WWW class doesn't support the HTTP headers in GET message,
but Google API must require the 'Authorization' header.
I wrote my own HTTP client for that reason.
Hi,
it seams that WWWForm support HTTP headers :
http://docs.unity3d.com/Documentation/ScriptReference/WWWForm.html http://docs.unity3d.com/Documentation/ScriptReference/WWWForm-headers.
here is the sample code :
public class example : MonoBehaviour {
public WWWForm form = new WWWForm();
public System.Collections.Hashtable headers = form.headers;
public byte[] rawData = form.data;
public string url = "www.myurl.com";
public WWW www = new WWW(url, rawData, headers);
IEnumerator Example() {
form.AddField("name", "value");
headers["Authorization"] = "Basic " + System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes("username:password"));
yield return www;
}
}
Yes, Unity3D WWW class supports the HTTP headers but only for POST.
It is impossible to use HTTP headers with GET, PUT.
Hi, i'm very interested in your plugin.
I'm creating a game with an included level editor. My idea was to use google drive in order to save player levels over multiples devices.
So i found your plugin, it works well on a desktop build, but i can't upload my apk on my android device. Your plugin use TcpClient wich is not authorized with Unity Basic for Android.
Unity have his own API to access web : WWW : http://docs.unity3d.com/Documentation/ScriptReference/WWW.html
Do you think you can use WWW instead of TcpClient ?