Created
July 3, 2014 03:33
-
-
Save cthornton/12f1252bd1910beedc00 to your computer and use it in GitHub Desktop.
Sample JTW Creation
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, | |
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