#!/bin/sh # Call Authentik's API as akadmin, from the VM. From https://exe.dev/deploy/authentik. # Usage: ./ak GET core/users/ | ./ak POST core/groups/ '{"name":"team"}' set -eu cd "$(dirname "$0")" token=$(sed -n 's/^AUTHENTIK_BOOTSTRAP_TOKEN=//p' .env) method=$1 path=$2 shift 2 curl -fsS -X "$method" -H "Authorization: Bearer $token" -H "Host: $(hostname).exe.xyz:8080" \ -H 'Content-Type: application/json' ${1:+--data "$1"} "http://127.0.0.1:9000/api/v3/$path"