Interacting with https

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
viro
Posts: 52
Joined: Fri Jul 05, 2013 6:59 pm

Interacting with https

Post by viro » Mon Jul 08, 2013 3:35 pm

Hey Guys, I'm trying to let my app login over https and save the cookie for further requests.

It's kind of weird because sometimes it just works and sometimes it does not! On windows it just works fine when setting this:

Code: Select all

libUrlSetSSLVerification false
I use this to login:

Code: Select all

local vName,vPass,vBody
global vUrl,vHeader
on changeLogin
   ask question "Wie lautet ihr Benutzername?"
   put it into vName
   ask password "Wie lautet ihr Passwort?"
   put it into vPass 
   put the text of fld "Json" into vBody
   replace "xx" with vName in vBody
   replace "yy" with vPass in vBody
   globaleUrl #sets the variable to default url eg "https://myurl,com"
   put "/api/login"after vUrl
   post vBody to url vUrl
   answer the result && it
   go to next
end changeLogin
My Json string to login looks like:

Code: Select all

{
"username":"xx","password":"yy"
}
The header looks like this:

Code: Select all

User-Agent: Appname
Content-Type: application/json; charset=utf-8
And to get the cookie into the header i use this:

Code: Select all

put char 5 to -1 of line lineoffset("Set-Cookie: PLAY_SESSION=",libURLLastRHHeaders()) of libURLLastRHHeaders() after vHeader
Every line in the header is followed by return eg "appname&&return utf-8&&return".
I tried it on two servers; 1 server with selfsigned ssl and 1 server with verified digi cert...

Hope somebody can help me out with this...
the funniest thing about this particular signature is that by the time you realize it doesn't say anything it's too late to stop reading it

viro
Posts: 52
Joined: Fri Jul 05, 2013 6:59 pm

Re: Interacting with https

Post by viro » Thu Aug 08, 2013 7:46 am

So it turned out it was a server problem where theserver has installed siogned certificates but it was not chained properly.
Actually livecode is able to login to webservices (if the webservice sends the cookie into the it variable)
the funniest thing about this particular signature is that by the time you realize it doesn't say anything it's too late to stop reading it

Post Reply