ruby & authToken

cedjo

Joined: 2007-02-27
Posts: 3
Posted: Tue, 2007-02-27 06:54

Hello,

I'm trying to access my gallery via a simple ruby script:

require 'net/http'
h=Net::HTTP.new("www.mysite.com",80)
resp,data=h.post("http://www.mysite.com/main.php?g2_controller=remote:GalleryRemote&g2_form[cmd]=login&g2_form[uname]=myname&g2_form[password]=mypassword",nil)

the response is:
[#<Net::HTTPOK 200 OK readbody=true>, "#__GR2PROTO__\nserver_version=2.11\ndebug_core_version=7,17\ndebug_module_version=1.0.8\nstatus=0\nstatus_text=Login successful.\ndebug_user=myname\ndebug_time=1,177s"]

#__GR2PROTO__
server_version=2.11
debug_core_version=7,17
debug_module_version=1.0.8
status=0
status_text=Login successful.
debug_user=myname
debug_time=1,177s

I never have a authToken parameter in the response of my script, any thought? I probably do something wrong but I don't really know what.

the same url http://www.mysite.com/main.php?g2_controller=remote:GalleryRemote&g2_form[cmd]=login&g2_form[uname]=myname&g2_form[password]=mypassword
used in a browser give:

#__GR2PROTO__
server_version=2.11
debug_core_version=7,17
debug_module_version=1.0.8
status=0
status_text=Login successful.
debug_user=myname
debug_time=0,075s
auth_token=d323bcaac6de

my gallery version is 2.2, ruby 1.8.5

 
conorboyd

Joined: 2005-03-29
Posts: 166
Posted: Tue, 2007-02-27 20:09

I can't really help you with Ruby specific stuff, but I had a similar issue trying to log in to a G2.2RC1 site using Delphi.

For me, the issue seemed to be the fact that my HTTP client object was not sending a KEEP-ALIVE header, I think. Therefore I assume Gallery doesn't think you're going to want to connect again in this session, so it doesn't send an auth_token.

Hopefully somebody with more knowledge of what Gallery is doing can clarify that.

And hopefully, that will give you some pointers to solve your issue.

Cheers,

Conor
Christchurch, NZ

GLoSS: Gallery2 Local Screen Saver & Desktop Changer

 
cedjo

Joined: 2007-02-27
Posts: 3
Posted: Wed, 2007-02-28 12:56

I added the keep-alive parameter in my request and check the answer the connection is still keep-alive, but no authToken parameter given

 
cedjo

Joined: 2007-02-27
Posts: 3
Posted: Sun, 2007-03-04 14:17

I've updated to 2-2rc2 and now it works!