Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Last active December 23, 2020 00:04
Show Gist options
  • Save StevenJL/081227c9f5a872ba33448cd6901e0b0c to your computer and use it in GitHub Desktop.
Save StevenJL/081227c9f5a872ba33448cd6901e0b0c to your computer and use it in GitHub Desktop.
JWT with sensitive information
require "jwt"
SIGNING_SECRET = 'jwtsigningsecret'
ALGORITHM = 'HS512'
# A payload with sensitive information
payload_sensitive = { social_security_number: "555-44-7777" }
# The token has been encoded, but not encrypted
token_with_sensitive = JWT.encode payload_sensitive, SIGNING_SECRET, ALGORITHM
# eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzb2NpYWxfc2VjdXJpdHlfbnVtYmVyIjoiNTU1LTQ0LTc3NzcifQ.LCuEVQ6869PnvA8gSyUDEVCdBQNOKFWTGTUa0_7jDwxG-rn3D3c8nx8_MOqdGnnxzy6i1FgGhCN-YkS-HNqgFA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment