Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Secure Sensitive Laravel Routes With Two-factor Authentication Using Authy

Blog post from Twilio

Post Details
Company
Date Published
Author
Michael Okoko
Word Count
2,838
Language
English
Hacker News Points
-
Summary

The Laravel application implements a re-authentication flow using Authy to secure sensitive routes and actions. The process involves creating a new middleware, `AuthyVerify`, that checks if the user has been verified within the past 10 minutes. If not, it redirects them to the verification page. The application also uses a controller, `AuthyController`, to handle the verification flow and update the session with the `is_verified` key. The verification process is implemented using Authy's API to verify the token sent by the user. The application also includes routes for deleting notes, which requires re-authentication via Authy. The code uses Laravel's built-in features such as middleware, controllers, views, and routes to implement the re-authentication flow.