Skip to content

Instantly share code, notes, and snippets.

@dwickstrom
Created January 3, 2024 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwickstrom/74287991e314ad8f46f2162dd0b210fc to your computer and use it in GitHub Desktop.
Save dwickstrom/74287991e314ad8f46f2162dd0b210fc to your computer and use it in GitHub Desktop.
Keycloak - Get IDP Token using curl

Keycloak - Get IDP Token

Get Access Token

export TKN=$(curl -X POST 'http://127.0.0.1:8080/realms/your-realm/protocol/openid-connect/token' \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "username=your-user" \
 -d 'password=your-pass' \
 -d 'grant_type=password' \
 -d 'client_id=admin-cli' | jq -r '.access_token')

Get IDP Token

curl -v -X GET 'http://127.0.0.1:8080/realms/your-realm/broker/your-provider/token' -H "Accept: application/json" -H "Authorization: Bearer $TKN" | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment