Get profile picture

I am making a game with Unity, so far I can get a list of viewers, send message in the chat and receive message. I need to get the profile picture of people in the chat, but here is my code and the error:

WebClient web = new WebClient();
System.IO.Stream stream = web.OpenRead(“https://api.twitch.tv/helix/users?id=39383020”);
using (System.IO.StreamReader reader = new System.IO.StreamReader(stream))
{
string text = reader.ReadToEnd();
Debug.Log(text);
}

“TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates)
Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 ()
Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process ()
(wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg)
Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult)
Rethrow as IOException: The authentication or decryption has failed.
Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult)
Rethrow as WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetResponse ()
System.Net.WebClient.GetWebResponse (System.Net.WebRequest request)
System.Net.WebClient.OpenRead (System.Uri”

This would suggest the the cert bundle, that you have installed with Unity is out of date. And a Unity update or sub module update needs to be installed

A brief google suggests:

This looks like a issue with Unity here rather than Twitch itself?

I am sure it’s all good, but my code is wrong. With the old API, I saw people sending username and oauth from the URL, now I don’t know how to certificate myself to the server.

The error you have posted about refers to SSL Certifcations and the fact that Unity is unable to verify the SSL certificate.

Its not oAuth related

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.