Feb 16, 2023
0
Level 1
SPA, Laravel 9 + sanctum, Session store not set on request
Hello. I'm trying to make SPA using sanctum. I did everything from the SPA part of the sanctum page in the laravel documentation. And I wrote the simplest possible login function:
Auth::attempt($email, $password);
and logout function:
Auth::guard('web')->logout();
$request->session()->invalidate(); // there will be a test error here
$request->session()->regenerateToken();
And it works well in the browser, but I can't do the test.
$user = User::factory()->create([...]);
Sanctum::actingAs($user, ['*'], 'web');
$response = $this->postJson($this->url, []);
And on the last line I get an error - "Session store not set on request."
I'm sorry for my english :( . I will be very grateful for any help.
Please or to participate in this conversation.