pycloud/get_token.sh

13 lines
458 B
Bash
Executable File

#!/bin/bash
source ./credentials
API_PORT=${API_PORT:-8080}
refresh_token=$(curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"${username}\", \"password\":\"${password}\"}" 127.0.0.1:${API_PORT}/login | jq -r .refresh_token)
echo refresh_token: $refresh_token
token=$(curl -X POST -H "Content-Type: application/json" -d "{\"refresh_token\":\"${refresh_token}\"}" 127.0.0.1:${API_PORT}/perform-login | jq -r .token)
echo token: $token