spatie/laravel-one-time-passwords
Securely generate and consume one-time passwords in Laravel. Ships with notifications (email by default, extensible to SMS/other channels) and a ready-to-use Livewire login component. Optionally enhances the OTP input UI automatically when Flux is installed.
Authenticatable, Guard, Session) and integrates seamlessly with middleware, events, and service providers.config/otp.php, routes/otp.php) remain intact, preserving ease of customization.HasOneTimePassword) and single-table schema remain unchanged.OneTimePasswordGenerated, OneTimePasswordUsed) still available for hooks.enforce_same_origin now respected (see Fix #55), which may impact cross-origin OTP flows (e.g., mobile apps or SPAs).composer.json still required.enforce_same_origin fix may break existing cross-origin OTP delivery (e.g., mobile apps). Requires explicit opt-in via config:
'enforce_same_origin' => false, // Default may now be `true`; verify.
enforce_same_origin is set to false in config/otp.php.enforce_same_origin in config/otp.php:
'enforce_same_origin' => env('OTP_ENFORCE_SAME_ORIGIN', false), // Explicitly set based on use case.
php artisan vendor:publish --provider="Spatie\OneTimePassword\OneTimePasswordServiceProvider" --tag="config"
actingAs with different origins).laravel-permission, etc.sanctum/passport if auth logic overlaps.enforce_same_origin based on your cross-origin needs before testing delivery.enforce_same_origin may default to true in future releases. Pin the version in composer.json if cross-origin OTPs are critical:
"spatie/laravel-one-time-passwords": "1.1.0"
enforce_same_origin is misconfigured. Debug using Laravel logs or browser DevTools (check for CORS errors).enforce_same_origin is enabled and not configured correctly. Implement client-side checks (e.g., warn users if submitting from an unsupported origin).How can I help you explore Laravel packages today?