Quantcast
Channel: Questions in topic: "ios platform"
Viewing all articles
Browse latest Browse all 3714

Accept self-signed certificate using WWW

$
0
0
We are building an iOS app via Unity. We have a login system that communicates with the client server through the use of the WWW: var headers = new Hashtable(); var url = _rootURL + "/api/auth?username=" + _username + "&password=" + _password; ; // Add a custom header to the request. // In this case a basic authentication to access a password protected resource. headers["Authorization"] = "Basic " + System.Convert.ToBase64String( System.Text.Encoding.ASCII.GetBytes(_username + ":" + _password)); headers["Accept"] = "application/json"; // Post a request to an URL var request = new WWW(url); DebugTools.Log("DB - Attempting HTTP Auth..."); yield return request; //.. process results from WWW request here... DebugTools.Log("DB - HTTP Auth response recieved..."); //MW: processing pList response can be disabled as unneccessary for simple server notification requests if (request.error != null) { //Assume failure to login if (callbackDelegate != null) callbackDelegate(false, "Could not authenticate, please check your internet connection"); DebugTools.Log("DB- Http auth error " + request.error); } When running this on iOS, it reports : "Http auth error The certificate for this server is invalid. You might be connecting to a server that is pretending to be "your-server.com" " We had this issue on Android which we solved a different way, but because I can't access the code that handles the networking call after it has been converted to iOS, I need to implement a fix in Unity. I have a physical copy of the server certificate on my machine, I would like to have it bundled with the app and to have the app add it as an exception so that iOS won't complain and (hopefully) I won't need to persist with our Android hack. Does anyone have any pointers?

Viewing all articles
Browse latest Browse all 3714

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>