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:
- 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
- Demonstrate how to decode a JWT and verify that it has not expired.