I'm having an issue setting cookies in Laravel 5.6. I'm currently working on logging in with Facebook, and have it all working as expected except that the Access Token won't store correctly in the Cookies. For some reason, it keeps storing a value which I am not familiar with and I can't figure out why.
To test this, I have modified my callback function to set a test cookie, and the same behaviour happens.
Here is my route which is being called:
Route::get('{provider}/callback', 'Auth\LoginController@handleProviderCallback');
Here is my handleProviderCallback method:
public function handleProviderCallback(string $provider)
{
Cookie::queue(Cookie::make('fb', 'test', 1000, '/', config('session.domain'), config('session.secure'), config('session.http_only')));
return redirect('/');
}
And here is the cookie which is then set to fb
:
eyJpdiI6IkFROTRzU2ZhTGQwXC9DOHZoR3lqVDZnPT0iLCJ2YWx1ZSI6ImpqWE8wSVpDRzBzT1p2WGxPdE5pYlE9PSIsIm1hYyI6IjA5NzYxODQ0MmFkZmE2NDQ1YmU5Zjg2Y2NmNjU1N2RhZmVmNjcxZjJmYjhmZmViMWEwZGU5NTE5ZDYxMWY2ZjAifQ==
I have tried this using actual values of course, which is why I have now reverted to just a test value to see what is happening. I have tried clearing all my cookies and cache, as well as trying it in both Chrome and Safari.
Why is it always setting a eyJ... value instead of the value I tell it to?