#!/usr/bin/env bash
set -eu

if [ "$#" -lt 3 ]; then
  echo "usage: get-admin-token.sh <base-url> <username> <password>"
  exit 1
fi

BASE_URL="$1"
USERNAME="$2"
PASSWORD="$3"

curl -fsSL \
  -H "Content-Type: application/json" \
  -d "{\"username\":\"${USERNAME}\",\"password\":\"${PASSWORD}\"}" \
  "${BASE_URL%/}/api/v1/auth/login"
