Hey everyone,
I am trying to perform a unitywebrequest using an HTTPS link and its failing. The error text in my webrequest instance is blank. Using HTTP in the link and everything works as it should. My webserver has a self signed certificate and apparently this is a problem from research ive done, is this true? I’ve tried doing this like
Thanks nilsdr, that solved it! For those searching: subclass CertificateHandler and override ValidateCertificate to return true. Assign a new instance to the www’s certificateHandler property. Be aware that this is not safe for production and you should get a signed cert.
Hi HarpSeal1
Sorry to bother you but I am new in this topic but I am trying to perform a unitywebrequest to connect Unity and one Service Watson outside of SDK for Unity( named Machine Learning). Since you could use unitywebrequest to connect by any http, for it, Could you share the Class that do it? Would it be possible? Thanks for your time
Alejandro
will always fail? If no, do you have a link or a working sample?
I’ve been trying for 2 days to make my https webserver working, and now that it’s working, I’m just hoping that I’m wrong with UnityWebRequest!
Hi Guys, I had a similar issue with the latest update of Unity (2018.2.x). Using this thread and others around the thread I was able to come up with a solution. My solution is document on the PlayFab forum:
This solution worked for me pretty well!. Actually I omitted using the amazon pub key due to the fact that I’m using my application in a LAN. Therefore, I changed the return value of the Validate Certificate method to always be true. It’s highly not recommended for a public app though.
using System;
using UnityEngine.Networking;
using System.Security.Cryptography.X509Certificates;
namespace PlayFab.Internal
{
public class CustomCertificateHandler : CertificateHandler
{
// Encoded RSAPublicKey
private static readonly string PUB_KEY = "";
/// <summary>
/// Validate the Certificate Against the Amazon public Cert
/// </summary>
/// <param name="certificateData">Certifcate to validate</param>
/// <returns></returns>
protected override bool ValidateCertificate(byte[] certificateData)
{
return true;
}
}
}
Also in any place we use a UnityWebRequest
using System;
CustomCertificateHandler certHandler = new CustomCertificateHandler();
UnityWebRequest www = new UnityWebRequest("url", "POST/GET...");
www.certificateHandler = certhndler();
Sorry for picking up an old thread, but the second part of your code doesnt match. You call certhndler() lick a method, but it isn’t from my understandng. Please could you either fix it or explain