Last active
December 23, 2020 00:04
-
-
Save StevenJL/081227c9f5a872ba33448cd6901e0b0c to your computer and use it in GitHub Desktop.
JWT with sensitive information
This file contains hidden or 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
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