Hi. I hope someone here can help as I'm very new to Gallery itself, as well as working with the remote interface protocol. For reference my gallery version is 2.3.1 and have the remote module 1.0.18 installed
I believe I have a cookie or auth token issue. I'm not totally clear on what (if anything) I need to do with the auth token so let me just get to the problem. When I send the login command everything appears to go ok and it shows that my admin user account is logged in. However, when I attempt any other commands I am logged in as "guest". For example if I send fetch-albums-prune there are no "viewable" albums (viewable=writable?), if I send fetch-albums I see all of my albums so it would appear things are working correctly other than my login being persistent. Example of server responses below...
Login Response
#__GR2PROTO__
server_version=2.14
debug_core_version=7,54
debug_module_version=1.0.18
status=0
status_text=Login successful.
debug_user=myadminuser
debug_time=0.607s
auth_token=560a2f5aed1c
Fetch-Albums-Prune Response
#__GR2PROTO__
debug_time_albumids=0.02s
status=0
album_count=0
status_text=No viewable albums.
debug_user=guest
debug_time=0.02s
I have a feeling I'm missing something with the auth_token from the initial login, do I need to include this somehow in future requests? Also, is there any command or procedure to end a session?
Thank you.
Posts: 8339
What type of user agent?
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 166
Yes, you need to cache the auth_token, and pass it as a parameter to all subsequent calls, e.g. &g2_authToken=3asdhj678
Another issue I had was that I had to actually sometimes make 2 consecutive calls to Login to get my session to be "persistent", although that may have been something I was doing wrong (I never really got to the bottom of it - documented at http://codex.gallery2.org/Gallery_Remote:Protocol#Delphi).
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 11
Thanks to you both.
The client is a windows app that I'm developing for my own needs. I decided to roll a wrapper for all of the remote commands since I couldn't find anything on the web, so I have a dll handling all the request/response. I'm just now running through a debug session with a simple test app to iron out the communication. I figured I would need to send the auth token back but didn't see any documentation specifically what the server expected (did I miss that somewhere?). I'll have to do a little work to grab the auth token from the response and send it back subsequent calls, I'll update after I get that done.
On a side note I saw mention of Delphi and Indy Library on the remote protocol docs with link to your screen changer, Conor. Since this is all new to me, can you shed some light on what the Indy Library is? Is this an uncompiled Delphi resource? I've never done anything with Delphi, I'm more of a C/VB guy. I figured I could roll out a VB DLL quicker than I could figure out what the Indy Library was and how to use it
Posts: 166
Think you must have overlooked it. ;-)
http://codex.gallery2.org/Gallery_Remote:Protocol#authToken
The Indy library is just a comprehensive collection tools/components for interacting with lots of different protocols (HTTP, FTP, etc). Yeah, the stuff I added to that Protocol page was only really of interest to Delphi people. I'm not trying to convert you. .NET might well have a fair amount of that functionality built in.
Happy to help if you're got more questions.
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 11
Thanks again Conor, I did indeed overlook that. Ok, so updating from where I left off...
I'm caching the auth_token value from my login and sending it back on subsequent requests but the server is still seeing me as "guest" on all requests (other than the login request). What is the exact format of the parameter that the server wants to see for the auth token?
I have tried:
g2_authToken=072d4cfc2d21 (for example)
also...
g2_auth_token=072d4cfc2d21
g2_form[authToken]=072d4cfc2d21
I have tried sending it as the first or last parameter and it doesn't seem to make any difference.
Posts: 166
I've found some debug output from my code which may be of some use.
Invoking Gallery command: http://mydomain.com/main.php?g2_controller=remote:GalleryRemote&g2_form[protocol_version]=2.11&g2_form[cmd]=login&g2_form[uname]=admin&g2_form[password]=********
and
Invoking Gallery command: http://mydomain.com/main.php?g2_controller=remote:GalleryRemote&g2_form[protocol_version]=2.11&g2_authToken=9186bf0faa8e&g2_form[cmd]=fetch-album-images&g2_form[albums_too]=no&g2_form[random]=yes&g2_form[limit]=1
I think I had to try invoking the Login method twice, but I assumed at the time it was something to do with the Indy library. Maybe you could try making the call to Login twice?
HTH,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 11
Hmmm... well my output is formatted correctly. I tried the double login but still no luck. However, I just tried running fetch-album-images and this was the response...
This looks like an error with the remote module, yes? Even if I am a guest I should be able to view images (I can view albums). Anyone want to weigh in on what my next move should be? Could it be that I have an old version of the remote protocol installed? My module_version=1.0.18 and the server_version=2.14
I have seen some server responses posted by other users that reports server_version as high as 2.8. I have no idea where to download this though? Shouldn't the remote module contain the latest server version??