Skip to content

Commit a20a82c

Browse files
committed
Improve bash authentication example
1 parent 8deb13d commit a20a82c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/client_bash_auth.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22

3+
# initialize cookie store
4+
cp /dev/null cookies.txt
5+
36
# login and store cookies in 'cookies.txt' AND retrieve the value of the XSRF token
4-
TOKEN=`curl 'http://localhost/api.php/' --data "username=admin&password=admin" --cookie-jar cookies.txt`
7+
TOKEN=`curl 'http://localhost/api.php/' --data "username=admin&password=admin" --cookie-jar cookies.txt --silent`
58

69
# strip the double quotes from the variable (JSON decode)
710
TOKEN=${TOKEN//\"/}

0 commit comments

Comments
 (0)