Sfoglia il codice sorgente

Improve bash authentication example

Maurits van der Schee 7 anni fa
parent
commit
a20a82cefd
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4
    1
      examples/client_bash_auth.sh

+ 4
- 1
examples/client_bash_auth.sh Vedi File

@@ -1,7 +1,10 @@
1 1
 #!/bin/bash
2 2
 
3
+# initialize cookie store
4
+cp /dev/null cookies.txt
5
+
3 6
 # 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`
5 8
 
6 9
 # strip the double quotes from the variable (JSON decode)
7 10
 TOKEN=${TOKEN//\"/}

Loading…
Annulla
Salva