filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.12k stars 2.95k forks source link

2FA #12662

Closed danharrin closed 1 week ago

danharrin commented 6 months ago

Donate 💰 to fund this issue

Fund with Polar

binaryfire commented 6 months ago

I recently implemented 2FA and had to make it pretty flexible, so figured I'd share some feedback:

x7ryan commented 4 months ago

I know it can be tempting to just implement fortify or go the fortify route of just directly integrating something simple like TOTP and calling it good. I for one am annoyed by how locked into that one method fortify is. IMO please build it yourself and make it modular using a driver based approach so the community can come in and make plugins for other forms of 2FA as we want.

binaryfire commented 4 months ago

I know it can be tempting to just implement fortify or go the fortify route of just directly integrating something simple like TOTP and calling it good. I for one am annoyed by how locked into that one method fortify is. IMO please build it yourself and make it modular using a driver based approach so the community can come in and make plugins for other forms of 2FA as we want.

This is a 2fa package that supports multiple drivers (might be useful for inspiration): https://github.com/worksome/laravel-mfa. I agree it'd be great to be able to support multiple methods. I've implemented both email codes and TOTP in my app and they're dynamically configurable, so each of my tenant owners can choose the 2fa method they want their users to use.

Fortify is a very thin wrapper around https://github.com/antonioribeiro/google2fa and https://github.com/Bacon/BaconQrCode. IMHO it's better to implement them directly rather than trying to use Fortify and be constrained by its limitations.