Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script for requesting a boss OIDC access token
#!/bin/bash
BOSS_TOKEN_URL="https://auth.theboss.io/auth/realms/BOSS/protocol/openid-connect/token"
echo -n "BOSS Username: "
read BOSS_USER
echo -n "BOSS Password: "
read -s BOSS_PASSWORD
echo -en "\nBOSS Client Id: "
read BOSS_CLIENT_ID
RESULT=$(curl -s $BOSS_TOKEN_URL \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=$BOSS_USER" \
-d "password=$BOSS_PASSWORD" \
-d 'grant_type=password' \
-d "client_id=$BOSS_CLIENT_ID" 2>/dev/null)
TOKEN=$(echo $RESULT | sed 's/.*access_token":"//g' | sed 's/".*//g')
echo -e "\n"
echo "Your authorization token is (copy the entire line):"
echo
echo "bearer $TOKEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment