-
Notifications
You must be signed in to change notification settings - Fork 284
Add Two Factor Authentication for React Starter Kit #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think this is better be its own starter kit |
# Conflicts: # routes/auth.php # tests/Feature/Auth/AuthenticationTest.php # tests/Feature/Auth/PasswordConfirmationTest.php
Waiting until we fix this bug in the Inertia |
Why is this using Fortify? I don't see how it makes sense to use part of that package when the rest of the authentication is already handled by open code. |
Its been merged! |
Hey It's needs to be tagged with new release in order to use it. I'm tracking it and will push changes once tagged. |
Don't bother they won't listen. Just wait for a maintainer to close this |
Thanks for the shout out @pushpak1300 😁 Excited to see this released 👍 |
e5f8b6f
to
29c28f5
Compare
29c28f5
to
e18dbbe
Compare
… errors instead of an object
e94aa8c
to
416b731
Compare
I have concerns about using Laravel Fortify solely for adding Two-Factor Authentication (2FA) in this pull request. The Laravel React Starter Kit is intended to be a lightweight foundation, and introducing Fortify, which is a more comprehensive and framework-agnostic authentication solution, feels like overkill for this specific feature.
I suggest exploring a lighter solution like google2fa-laravel, Laragear/TwoFactor or a custom 2FA implementation to keep the starter kit lean while still providing robust security. If Fortify is retained, a clear justification for its inclusion over simpler alternatives would be helpful. Looking forward to hearing your thoughts! |
Thanks for raising these points! I totally get the concern about keeping the starter kit lightweight. The reason we went with Fortify here is that it’s already battle-tested and gives us a reliable foundation for 2FA without reinventing the wheel. We’re still evaluating Fortify’s usage across the other parts of the starter kits, but that’s outside the scope of this MR, so those changes aren’t included here. For 2FA specifically, we’ll stick with Fortify since it provides configurable options that teams can easily opt-in or opt-out of depending on their needs. |
Thanks for the follow-up! One more angle from the starter kit perspective: this repo is meant to be a starting point that teams are encouraged to adapt. In that spirit, 2FA doesn't need to live in the base by default. And if we do ship it, it should be trivial to remove or toggle off so teams who don't need OTP aren't forced to carry that surface area. A focused package like Laragear/TwoFactor We could also include a simple config toggle inside the package config file (e.g., two-factor.enabled = false by default) so projects can enable it in one place, or remove it entirely, keeping the kit lean. I'm happy to open a small follow-up showing this approach that I've already implemented in a project. For full transparency: I'm one of those who often push back on Fortify/Jetstream and prefer the simplicity of Breeze, so I may be a bit partial here. I'm sure there are others who will be happy to have it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @pushpak1300 👍
# Conflicts: # resources/js/app.tsx # resources/js/components/delete-user.tsx # resources/js/layouts/settings/layout.tsx # resources/js/pages/auth/confirm-password.tsx # resources/js/pages/settings/password.tsx # resources/js/pages/settings/profile.tsx
This MR adds Two-Factor Authentication (2FA) functionality to the React Starter Kit using Laravel Fortify's built-in support for 2FA
🔒 Backend Changes
We are now leveraging Fortify for handling two-factor authentication. Since Fortify provides additional security features out of the box, this MR also replaces our custom implementation of the password confirmation page with Fortify’s native confirm password functionality.
🖥️ Frontend/UI Updates
The UI has been updated to handle all the two-factor settings based on Fortify's configuration. The following Fortify features are enabled:
Demo
https://www.loom.com/share/6bf836eccae84778a511916a9d02bb59?sid=efb1fac2-7482-40ec-82e6-31f0b3fa77a8
Co-authored-by: Tony Lea [email protected]
Thanks to #101