Login sessions to external server

Hi!

How do you make authenticated sessions with network request() in Corona?

Let’s say I run: network.request(“http://example.com/?action=login&username=abc&password=123”, “GET”, listener);

The server would return: Set-Cookie: PHPSESSID=; path=/

However, there is no mechanism in Corona to read HTTP headers from network responses AFAIK. (Correct me if I’m wrong!)

The best idea I’ve come up with is to return the session ID as part of the normal response body, and then pass it to the server for subsequent calls using the params argument in network.request()

What is the best practice in this situation?

[import]uid: 73434 topic_id: 31964 reply_id: 331964[/import]

I suggest you serialize your data to a json string on the server side and then parse the json string using json.decode to create a lua table with your data. [import]uid: 54030 topic_id: 31964 reply_id: 127531[/import]

I just did some testing, and it seems that Corona receives and sends cookies automatically in network.request() - though this seems to be documented nowhere! If this is the case, this is a nice surprise :slight_smile:
[import]uid: 73434 topic_id: 31964 reply_id: 127626[/import]

I suggest you serialize your data to a json string on the server side and then parse the json string using json.decode to create a lua table with your data. [import]uid: 54030 topic_id: 31964 reply_id: 127531[/import]

I just did some testing, and it seems that Corona receives and sends cookies automatically in network.request() - though this seems to be documented nowhere! If this is the case, this is a nice surprise :slight_smile:
[import]uid: 73434 topic_id: 31964 reply_id: 127626[/import]

***SO*** Any news on this issue??? I am at night working around this with no success
[import]uid: 157104 topic_id: 31964 reply_id: 144481[/import]

Double post removed.

We are working on a solution. [import]uid: 199310 topic_id: 31964 reply_id: 144486[/import]

***SO*** Any news on this issue??? I am at night working around this with no success
[import]uid: 157104 topic_id: 31964 reply_id: 144481[/import]

Double post removed.

We are working on a solution. [import]uid: 199310 topic_id: 31964 reply_id: 144486[/import]

***SO*** Any news on this issue??? I am at night working around this with no success
[import]uid: 157104 topic_id: 31964 reply_id: 144481[/import]

Double post removed.

We are working on a solution. [import]uid: 199310 topic_id: 31964 reply_id: 144486[/import]

***SO*** Any news on this issue??? I am at night working around this with no success
[import]uid: 157104 topic_id: 31964 reply_id: 144481[/import]

Double post removed.

We are working on a solution. [import]uid: 199310 topic_id: 31964 reply_id: 144486[/import]