Skip to content

Instantly share code, notes, and snippets.

@sokil
Last active July 27, 2022 18:51
Show Gist options
  • Save sokil/939965471f74a2c7ea9ab187bf39fc69 to your computer and use it in GitHub Desktop.
Save sokil/939965471f74a2c7ea9ab187bf39fc69 to your computer and use it in GitHub Desktop.
Unpack JWY in Bash
curl -XPOST -H 'Content-Type: application/x-www-form-urlencoded' \
http://localhost:8080/auth/realms/{realm}/protocol/openid-connect/token \
-d 'grant_type=client_credentials&client_id={client}&client_secret={sectet}' \
2>/dev/null | jq '.access_token | split(".") | .[0],.[1] | @base64d | fromjson'
{
"alg": "RS256",
"typ": "JWT",
"kid": "j1zghTz1wRP5BNa1TNHF11Wz10whKwoM1Rn1B6YM11c"
}
{
"exp": 1658947892,
"iat": 1658947592,
"jti": "3f4b2911-196d-48a0-8c13-b349d4554b8e",
"iss": "http://localhost:8080/auth/realms/realm",
"sub": "99686cb6-908e-471c-b945-6c1da9f43713",
"typ": "Bearer",
"azp": "client",
"acr": "1",
"scope": "userId",
"userId": "99686cb6-908e-471c-b945-6c1da9f43713"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment