Last active
August 29, 2015 14:03
-
-
Save cthornton/b4be57ea19cf4eb60737 to your computer and use it in GitHub Desktop.
JWT Creation with jti
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
auth_header = JWT.encode({ | |
user_id: 123, | |
jti: rand(2 << 64).to_s, # One-time use token | |
iat: Time.now.to_i, # Specify the time the token was issued. | |
exp: Time.now.to_i + 2 # Expire the token in 2 seconds | |
}, "<my shared secret>") | |
RestClient.get("http://api.example.com/", authorization: auth_header) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment