N
N
Nikidze2021-10-03 12:14:10
HTTP Cookies
Nikidze, 2021-10-03 12:14:10

Why aren't laravel cookies or session remembered when using socialite?

There is a piece of code:

public function redirectToGoogle($profileType)
{
     return Socialite::driver('google')->redirect()->cookie(Cookie::create('i_want_to_be',$profileType)->withExpires(Carbon::now()->addDay()->unix()));
}


It is in the controller. I tried to set cookies and session in a variety of ways, none of them work. After the user has logged in, the session or cookies are deleted. Why this is happening I don't know.

If you redirect to the callback page bypassing Google's authorization and the session and cookies are saved

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question