JSON Web Tokens

Challenge

Only editable by group admins

  • Last updated November 26, 2019 at 7:25 PM by cpr
  • Evidence only visible to badge awarders
Solve this learning challenge by posting answering the quiz question and completing the code challenge.
Note: The quiz question can be answered within the code snippet itself. Or in the body of the submitted evidence.

Quiz Question
Describe in simple language how a JWT-based authorization flow works in a practical scenario.

Code Challenge
To solve this challenge, post a ruby code snippet with the requested requirements:
  1.  Demonstrate how to encode a JSON Web Token with a single payload that contains a user’s email address and their first name and last name. Note: The JWT should expire after 24 hours
  2. Demonstrate how to decode a JWT and verify that it has not expired.