login and password can be passed as command line parameters

This commit is contained in:
Uwe Steinmann 2023-05-13 17:05:31 +02:00
parent 45af226bca
commit 62d6ab86c5

View File

@ -2,7 +2,16 @@
. ./credentials
USERNAME="admin"
if [ -n "$1" ]; then
USERNAME=$1
fi
PASSWORD="admin"
if [ -n "$2" ]; then
PASSWORD=$2
fi
JSON="{\"username\":\"$USERNAME\",\"password\":\"$PASSWORD\"}"
curl --silent -X POST "${URL}/api/token/" \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"admin"}' | jq '.'
-d $JSON | jq '.'