Created
July 14, 2021 17:19
-
-
Save tuxfight3r/b67e94e5a09c61c0c31b00ec0a6e8eb5 to your computer and use it in GitHub Desktop.
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