Add to Chrome
✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
What is the purpose of the following code in the `login` method, and how is JWT used?
The code generates a unique JWT for each user and stores it in the database for subsequent authentication.
The code verifies the authenticity of a JWT by checking the user's email and password against the decoded token.
The code authenticates a user based on their email and password, and upon successful authentication, generates a JWT containing the user's ID.
The code decodes a JWT using the Rails application secret key and renders the resulting user information in JSON format.
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!