- Home /
Using https and SSL
I have a very simple script for logging in a user and it works great in http on my stand alone build. I am about to purchase an SSL certificate and have no experience of working with SSL and https. What changes would I need to make to the script below in order to work with https?
var phpURL: String = "http://www.mywebsite.com/phpscripts/login.php";
var form = new WWWForm();
form.AddField("username", username);
form.AddField("password", password);
var w = WWW(phpURL, form);
yield w;
Answer by Fattie · Apr 27, 2013 at 08:51 PM
thank goodness, there is NOTHING you have to do, other than, add the "s"
var phpURL: String = "http://www.mywebsite.com/phpscripts/login.php";
change to:
var phpURL: String = "https://www.mywebsite.com/phpscripts/login.php";
that's it. Hope it is good news! :)
well, NOTHING other than having a website that supports SSL ;)
If I understand correctly, this approach will appear to work, but will not enforce that the site has a valid SSL certificate--disappointingly. At least, this appears to be what's happening in my project currently.
@bitbutter You are correct, SSL certificates are not checked for validity.
It's not that simple if you are targeting Android also. There is a big probability that you will get HttpError:javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException
New answer here using HttpWebRequest which supports authentication, and control over accepted certificates.
Your answer
Follow this Question
Related Questions
POST a form over HTTPS with unvalidated SSL Certificate 2 Answers
WWW/WWWForm, does Unity validate SSL certificates? 1 Answer
WWW/WWWForm, does Unity validate SSL certificates over HTTPS? 0 Answers
Mysql PDO Register user insert not inserting, no error feedback 0 Answers
Manually validating SSL certificates (no WWW involved) 1 Answer