0 votes

I am really struggling here to get the C# Httpclient to accept a https address. I keep throwign an erorr about Tls, and I have looked around but I have no idea how to get it to work.

EDIT:
I have made a sample repo for what I am trying to do. https://github.com/PoisnFang/PokeGodot
It is a pretty simple concept, the logic is in Lobby.cs when you press the host button I want it to call the pokeapi and print the info the console. When you run it though it will throw an error about Tls and I do not know how to fix it. I realize that it has to do with CORS and I need a SSL cert in order to request info from an HTTPS source, but I dont know how to actually implement that....

private async void GetDitto()
{
    HttpClient client = new HttpClient();
    var response = await client.GetAsync("https://pokeapi.co/api/v2/pokemon/ditto");
    response.EnsureSuccessStatusCode();
    var pokemon = await response.Content.ReadAsStringAsync();
    GD.Print(pokemon);
}

I also realize that I CAN use the built in HHTPClient that Godot has in order to get THIS scenario to work, however for my future implementations it will NOT.

Godot version 3.2.2
in Engine by (19 points)
edited by

1 Answer

0 votes

You did not forget about Same-origin policy?

https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

Edit

Cert store bundled with godot's mono is outdated. Your only option is recompile with updated certificates.

https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html

by (536 points)
edited by

While I appreciate what you are trying to ask, I have updated my question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.