Using HTTP Basic Authentication
curl -X GET -H 'Content-Type: application/json' \
-u <username>:<password> \
http://localhost:8080/recipes/confidential
Using Cookies
If you log in with a username and password and then want to use a cookie as the auth token, you can do the following:
1) First use curl to post username and password to the cookie_form and store a cookie for it locally:
curl --cookie-jar cookies.txt -d "user=<username>&password=<password>&submit=submit" <yourwebsite.com>/challenge/cookie_form
2) Pass the created cookie to subsequent post to upload tiddlers
curl --cookie cookies.txt -X PUT -H 'Content-Type: text/plain' --data-binary @<filename> <yourwebsite.com>/bags/default/tiddlers/monkey
sourceIf you log in with
OpenID and can't do the above because of the multiple steps involved to validate the
OpenID you can instead do the following:
- Log in with OpenID in a browser.
- Visit the cookies for the current domain and get the value of the tiddlyweb_user cookie.
- Make your curl request, but add a Cookie header containing that value as a tiddlyweb_user cookie:
curl -H 'Cookie: tiddlyweb_user=username.openid.com:xxxxxxxxxxxxxxxxxxx' -X PUT -H 'Contenet-Type: text/plain' \
--data-binary@<filename> <yourwebsite.com/bags/default/tiddlers/monkey