Failing authorisation due to incorrect formatting and encoding of the authorisation header can cause that exception. Check if this helps: Getting invalid authorization - #7 by csmith
Another possibility is the security protocal being used by the request. It’s been a while but in my own code I have commented out a couple of lines where I had to explicitly set the protocol because older versions of .NET defaulted to one that was not supported.
You could try playing around with that, check which protocol is being used before the request:
i As Integer = ServicePointManager.SecurityProtocol
And then try changing it to a different one and seeing if that fixes things
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.XXX
I think there might be a minimum level of .NET needed. I’m not an expert and it’s been a while. I had to trial and error it at the time, but now (with a newer version of .NET) it works by default for us.