- Home /
WebPlayer WWW Authorization always prompts for credentials
Hello, when I upload my game to my web site (using Windows/IIS) and then connect to the web site via the browser it prompts me for the web service credentials.
In my code I have filled in the credentials in the header and tried every thing I can think of but nothing makes this dialog go away except if I type in the user name and password in the browser which customers wouldn't (and shouldn't) know the credentials for.
Here is my code:
string url = Consts.MyAPIUrl;
public IEnumerator TestWebService()
{
WWW www;
byte[] toEncodeAsBytes = System.Text.Encoding.UTF8.GetBytes(UserName + ":" + UserPassword);
string base64 = System.Convert.ToBase64String(toEncodeAsBytes);
WWWForm form = new WWWForm();
var headers = form.headers;
byte[] rawData = form.data;
headers["Authorization"] = "Basic " + System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(UserName + ":" + UserPassword));
www = new WWW(url, rawData, headers);
yield return www;
if (null != www)
{
List<MyData> data= null;
data = (List<MyData>)LitJson.JsonMapper.ToObject<List<MyData>> (www.text);
}
}
Comment