0 votes

I've spent hours trying to get this to work so maybe someone can confirm if I'm wasting my time.

Currently I have a script on my server that makes a call to a third party site where I pass in a username and password. That site creates a session and then redirects to another site which takes the session data along with the credentials passed and creates an authentication token. That token allows me to then make calls to their api.

My site uses curl to send the request with the following:

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('application/x-www-form-urlencoded','Connection: Keep-Alive'));
curl_setopt($curl, CURLOPT_URL, $myurl);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLINFO_HEADER_OUT, 1);
curl_setopt($curl, CURLOPT_COOKIEFILE, "");

This works perfectly on my site to get the token generated but of course when I try and achieve the same thing in godot I'm hitting a wall. Using httpRequest does not work because it will redirect without the session data and if I change "maxredirects" to zero the request does not complete (requestcompleted is never called). If I use httpClient to have more control I don't see a way to stop a redirect at all.

Any help would be appreciated. I was considering using gdnative to be able to use curl but looking at the amount of effort required, if the only option was to go that route I would probably have to avoid using godot for this particular project.

asked Mar 18, 2018 in Engine by notamonopoly (12 points)

I have a rather small window to port my web application to a native app, is there anyone that can say if what I'm trying to achieve is doable with godot off the shelf? Is there a better place to ask these questions?

Please log in or register to answer this 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.