"会话存储未按要求设置。"与谷歌2fa

时间:2017-11-15 14:49:04

标签: laravel authentication request

我使用了一个教程来实现Google的2FA:https://www.sitepoint.com/2fa-in-laravel-with-google-authenticator-get-secure/

ValidateSecretRequest类从App \ Http \ Requests扩展;但我没有在我的"请求" - 文件夹中有这个课程。所以我用过Illuminate \ Http \ Request;

但是当我在Controller中调用这个类时,我得到一个错误。

RuntimeException - 未根据请求设置会话存储 ... / vendor / laravel / framework / src / Illuminate / Http / Request.php 411

public function session()
    {
        if (! $this->hasSession()) {
            throw new RuntimeException('Session store not set on request.');
        }

        return $this->getSession();
    }

有人知道如何处理吗?

1 个答案:

答案 0 :(得分:0)

之前我遇到了同样的问题,但我通过设置存储/ *的权限来修复它:

chmod -R 777 storage/*

OR

chmown -R www-data storage/*

如果您使用文件作为会话驱动程序,可能是因为这些权限问题。