python decode kubernetes service token (JWT Token)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# retrieve the default kubernetes service account token | |
kubectl get secret $(kubectl get serviceaccounts default -o jsonpath='{.secrets[0].name}') -o json|jq -r .data.token |base64 -D | |
# Decode it using Python (pip install PyJWT) | |
import jwt | |
var="encoded.jwt.token" | |
jwt.decode(var, options={"verify_signature":False}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment