【发布时间】:2021-01-16 01:41:53
【问题描述】:
我正在努力弄清楚如何在不使用 Jetstream 的情况下实现 Laravel/Fortify (https://github.com/laravel/fortify) 提供的 2FA。目前没有关于如何操作的文档。
我在 config/fortify.php
twoFactorAuthenication
'features' => [
// Features::registration(),
// Features::resetPasswords(),
// Features::emailVerification(),
// Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
我在Providers\FortifyServerProvider
twoFactorChallengeView
public function boot()
{
Fortify::twoFactorChallengeView('auth.two-factor-challenge');
我用来测试登录的帐户在two_factor_secret 和two_factor_recovery_code 字段中设置了值
我什至将我的代码与具有 2FA 的工作应用程序(全新安装的 Laravel 8 和 Jetstream)进行了比较,但我看不出配置有任何差异。
我能够成功验证,但从未触发 2FA 质询。
我错过了什么?
【问题讨论】:
-
什么不适合你?我认为您确实发布了强化资产。路线现在可用吗?
-
我无法触发 2FA。如果我手动导航到
/two-factor-challenge路线,它会立即重定向我。所以路由已注册,但逻辑不起作用。