Skip to content
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

Session is always empty #107

Open
top-challenger opened this issue Jan 29, 2019 · 1 comment
Open

Session is always empty #107

top-challenger opened this issue Jan 29, 2019 · 1 comment

Comments

@top-challenger
Copy link

Hi.
I am using this Slim\Extras\Middleware\CsrfGuard.php
But I always get this error. Invalid or missing CSRF token.

if (! isset($_SESSION[$this->key])) {
      $_SESSION[$this->key] = sha1(serialize($_SERVER) . rand(0, 0xffffffff));
}
$token = $_SESSION[$this->key];
$userToken = $this->app->request()->post($this->key);
if (isset($userToken) && $token !== $userToken) {
        $this->app->halt(400, 'Invalid or missing CSRF token.');
}

I have checked slim csrf_token so I can get successfully but I always go into in this condition.
if (! isset($_SESSION[$this->key]))
Session is always empty I think.
How can I fix this?
I will appreciate any other's help.

@top-challenger
Copy link
Author

Hi @silentworks
Could you please help me with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant