Developer:SessionCookie

From myExperiment
Jump to: navigation, search

The session controller requires just a username and password to give you a session cookie. This is done by posting a document like the following to http://www.myexperiment.org/session (Remember to set the Content-Type of your POST request to application/xml):

 <session>
   <username>myusername</username>
   <password>mypassword</password>
 </session>

You can test drive this using curl:

$ curl -D headers.txt -H 'Content-Type: application/xml' -d '<session><username>myusername</username><password>mypassword</password></session>' 'http://www.myexperiment.org/session'

This then gets you a session cookie. An example cookie header (which the above curl invocation will save to headers.txt) is:

 Set-Cookie: myexperiment_session=4fc0c2532e983352200d817a4513ae96; path=/

With this, you can then specify the session cookie to authenticate further requests, e.g.:

$ curl -b myexperiment_session=4fc0c2532e983352200d817a4513ae96 http://www.myexperiment.org/whoami.xml

If you need any further help about authentication, please contact the developers mailing list.