Skip to content

Instantly share code, notes, and snippets.

@reidstidolph
Last active September 22, 2018 00:05
Show Gist options
  • Save reidstidolph/3831b54bf00b425c6dcd2cd980a9eba2 to your computer and use it in GitHub Desktop.
Save reidstidolph/3831b54bf00b425c6dcd2cd980a9eba2 to your computer and use it in GitHub Desktop.
Simple bash script for retrieving a 128T API token.
#!/bin/bash
read -p '128T host address (press enter for localhost): ' ADDRESS
if [[ -z "$ADDRESS" ]]; then
ADDRESS="127.0.0.1"
fi
read -p 'Username: ' USER
read -s -p 'Password (hidden): ' PASS
echo
echo Retrieving token...
echo
curl -X POST -H 'Content-Type: application/json' -d "{\"username\": \"$USER\", \"password\": \"$PASS\"}" -k https://$ADDRESS/api/v1/login
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment