Nov 30, 2023
0
Level 1
Manually set laravel_session and XSRF_TOKEN and login
Hey everyone,
I have a scenario where I need to manually set the laravel_session and the XSRF_TOKEN when I return to my VUE SPA. I use Laravel Sanctum for authentication. Can anyone help me how to do it exactly by filling out the parts with question mark?
// Working code:
$user = User::where('email', $externalEmail)->firstOrFail();
$session = session()->getId();
// The part with my questions:
$laravel_session_cookie = ... ?
$xsrf_token_cookie = ... ?
return Redirect::to(frontendUrl())->withCookie(...);
The point would be is that after redirect, I would like to have the same laravel_session and xsrf_token set like I would have done a 'normal' laravel login supported by Sanctum.
Thank you for your help!
Please or to participate in this conversation.