Skip to content

Instantly share code, notes, and snippets.

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