Parse RestAPI in Unity WebGL build not working on Google Chrome
I am trying to integrate Parse in Unity Webgl build. As there is no specific SDK for WebGL provided by parse so for parse communication i am using RestAPI to Get the data from parse. As provided in parse help first i have created a user at the parse dashboard. Using those credentials i first login to the parse from the app using following code:
WWWForm form = new WWWForm();
var headers = form.headers;
headers["X-Parse-Application-Id"] = ParseHandler.Instance.ApplicationID;
headers["X-Parse-REST-API-Key"] = ParseHandler.Instance.RestApiKey;
headers["Content-Type"] = "application/json";
WWW www = new WWW("https://api.parse.com/1/login?username=abc&password=abcpassword", null, headers);
yield return www;
if (www.error != null)
{
isInitialized = false;
}
else
{
isInitialized = true;
}
After login in successfully i try to get the data of specific person using following code:
WWWForm form = new WWWForm();
var headers = form.headers;
headers["X-Parse-Application-Id"] = ParseHandler.Instance.ApplicationID;
headers["X-Parse-REST-API-Key"] = ParseHandler.Instance.RestApiKey;
headers["Content-Type"] = "application/json";
WWW www = new WWW("https://api.parse.com/1/classes/PlayerProfile?where={\ "ID\ ":\ "20489\ "}",null,headers);
if (www.error != null)
{
if (responseDelegate != null)
responseDelegate(null);
}
else
{
if (responseDelegate != null)
responseDelegate(www.text);
}
When i open this WebGL build on Firefox after login in to facebook parse starts initializing and it works perfectly fine. It do login and get the data but when i try to Open the build on Google Chrome it gives following error and parse doesn’t able to login or get data from parse: Refused to set unsafe header "User-Agent"
Please help how can i fix this issue. As we don’t want to shift this app to webplayer as chrome doesn’t support webplayer, also it has a prerequisite of downloading unity webplayer and all our data is already maintained on parse for different platforms.
I have hosted the app at the following link : “https://www.leatherjacketmaster.com/goa/index.html”
Answer by Binex-UmairBhatti · Jan 27, 2016 at 06:47 AM
i have done a work around because of User-Agent header error i was trying to used different User-Agent values according to forums but it was not working but i removed the User-Agent and didn't send any User-Agent it did giving error but no i am getting the response
I am also not passing any User-Agent as you can see in my code but still i am getting error on response.
Your answer
Follow this Question
Related Questions
GL_INVALID_FRAMEBUFFER WebGL using LWRP 1 Answer
Using LookAT causes no rotation at all? 1 Answer
rotation problems 0 Answers
Rotate character 0 Answers