Skip to content

Instantly share code, notes, and snippets.

@gustavolopess
Last active May 6, 2019 14:29
Show Gist options
  • Save gustavolopess/30b1b4c3205458726efe3e7588fb666e to your computer and use it in GitHub Desktop.
Save gustavolopess/30b1b4c3205458726efe3e7588fb666e to your computer and use it in GitHub Desktop.
header = {
"typ": "JWT",
"alg": "HS256"
}
payload = {
"userId": "55395427-265a-4166-ac93-da6879edb57a",
"exp": 1556841600
}
encoded_header = base64UrlEncode(header)
encoded_payload = base64UrlEncode(payload)
signature = HMACSHA256(encoded_header + '.' + encoded_payload, secret)
JWT = encoded_header + '.' + encoded_payload + '.' + base64UrlEncode(signature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment