-
Notifications
You must be signed in to change notification settings - Fork 1
Okta:Auth to Okta:BASH
lbonanomi edited this page Feb 24, 2024
·
2 revisions
Auth to Okta as:
auth() {
RAW=$(curl -s -X POST -d "client_id=$API_AUTH_ID&scope=openid profile offline_access okta.apps.read okta.apps.manage" $AUTH_ROOT/oauth2/v1/device/authorize | jq -r '"\(.verification_uri_complete) \(.device_code)"')
URI=$(echo $RAW | awk '{ print $1 }')
CODE=$(echo $RAW | awk '{ print $2 }')
echo "Go to $URI and do auth-dance" >&2
read DANCE
TOKEN=$(curl -s -X POST -d "device_code=$CODE&grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=$API_AUTH_ID" $AUTH_ROOT/oauth2/v1/token | jq .access_token | tr -d '"')
echo "$TOKEN"
}
And use received TOKEN as:
curl -s -H "Authorization: Bearer $TOKEN" $OKTA_ROOT"/api/v1/apps
- Backup-and-Restore
- Console
- Emergencies
- Housekeeping
- Integrations-and-External-Programs
- Search
- Throttles
- Usage