Skip to content

Commit 24522ce

Browse files
committed
Added comments
1 parent e069d28 commit 24522ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/client_bash_auth.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
2+
3+
# login and store cookies in 'cookies.txt'
24
curl 'http://localhost/api.php/' --data "username=admin&password=admin" --cookie-jar cookies.txt --silent >/dev/null
5+
6+
# retrieve the value of the 'XSRF-TOKEN' cookie
37
TOKEN=`cat cookies.txt|grep XSRF-TOKEN|cut -f 7`
8+
9+
# set the 'XSRF-TOKEN' as the 'X-XSRF-Token' header AND send the cookies to the server
410
curl 'http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1' --header "X-XSRF-Token: $TOKEN" --cookie cookies.txt
11+
12+
# clean up
513
rm cookies.txt

0 commit comments

Comments
 (0)