×
Maintenance Notice: labkey.org will be offline at 10:00 AM Pacific Time on Sunday, July 14th 2024 for maintenance. The estimated downtime should be no more than one hour. Please save your work before this time. We apologize for any inconvenience.

Use of cookie still working in labkey 17.x for non-api page ?

General Server Forum (Inactive)
Use of cookie still working in labkey 17.x for non-api page ? toan nguyen  2018-01-24 12:59
Status: Closed
 
Hi,

 I tried to following the example in this page
http://www.fourproc.com/2011/08/25/accessing-a-labkey-server-with-python-node-js-or-wget.html

 I tested the wget (use our labkey server url) with saving and loading cookies. It does not seem to work. Any help is appreciated.
 With or without cookie loading, I still get the same http return.

Thanks
Toan

>> wget --server-response --save-cookies cookies.cpas --keep-session-cookies \
>>https://your.labkey.server/Login/login.post --post-data "email=myEmail&password=myPassword"
>>wget --load-cookies cookies.cpas https://your.labkey.server/labkey/wiki/Home/page.view?name=securedWiki
 
 
Jon (LabKey DevOps) responded:  2018-01-24 13:37
Hi Toan,

There have been some changes since the time that example was written back in 2011.

Per our 17.2 docs, we actually deprecated that old LoginAction post handler:

https://www.labkey.org/Documentation/Archive/17.2/wiki-page.view?name=releasenotes172

You should be able to switch out your old POST action to using the new LoginApiAction that's outlined here:

https://www.labkey.org/Documentation/wiki-page.view?name=customLogin

So you would have to swap out the login.post URL you have for something like: https://[server]/login-loginApi.api

Additionally, you would also need to obtain a CSRF token as well to prevent a CSRF attack during the POST operation:

https://www.labkey.org/Documentation/wiki-page.view?name=csrfProtection

Regards,

Jon
 
toan nguyen responded:  2018-01-24 14:59
That did it.
Thank you very much.

Toan