I’m having trouble making a URL connection to a site using an API that I’ve been using with them for years. My code hasn’t changed. The API hasn’t changed. The site hasn’t changed. And it works on Windows. But of course Apple with their puritanical hyper-scared need for security is not working. This is the error I get:
An SSL error has occurred and a secure connection to the server cannot be made.
OK. So what is needed to get around this. Like I said - it works just fine on Windows.
How do I make this work in MacOS? What new hoops do I have to jump through. No, my app is not sandboxed. It is not and will not be a store app.
URLConnection on macOS is required to be https (ie http gives this error), UNLESS you add a plist entry to allow a specific (or wildcard) domain for the app.
Well, I’ve worked around this by adding the plist entry to allow insecure arbitrary site connections. For some reason it wouldn’t work when I specified the global cache site. Maybe I needed to add the port number.
But now it’s working. I would still like to understand why it fails when I have the https in place in the URL. I’d rather have it be secure. What I don’t know is this something in Xojo that is broken or is it a problem with the website I am accessing?
I don’t think Xojo broke anything here, URLConnection sits atop system APIs. That’s why it would work on one system but not the other. If it were Xojo at fault, it wouldn’t work on either.
Does your system actually trust the certificate? That’s where I’d start looking.
I’ve never done anything in terms of trusting or not trusting the certificate from the site. And I’ve tried this on both my Macs. I’ve got access to one that isn’t mine so I can try it there and see.
As a data point, the code you posted works here. I get a response about an internal server error, so the URLConnection is successfully making its SSL connection.
If you are getting this as an Error event with an exception, what is the exception error number? That could provide more information about what specifically the SSL error is.
Nope! And I’m trying on another Mac right now that I have access to but which is not on my iCloud account. And nope. Same thing. Connection doesn’t happen.
I think it’s something in Monterey.
This is why I questioned if it was something broken in Xojo. Did Monterey add some sort of requirement for secure URLConnections that Xojo mangled or missed?