Laravel 5.4 - 曲奇队列
问题描述:
我使用Laravel 5.4和我写的是这样的:Laravel 5.4 - 曲奇队列
Cookie::queue(
'refresh_token',
$data->refresh_token,
864000, // 10 days
null,
null,
false,
true // HttpOnly
);
return response('hello world');
返回的响应不包含refresh_token饼干而return response('hello world')->withCookie(...)
一样。
Laravel 5.4文档不再像5.0 doc一样状态排队cookie。 这是否意味着该功能已在版本5.4中删除,或者我在代码中犯了错误?
为了完整起见,我使用了Dingo API包,并将其制作成响应。
谢谢你的帮助。
答
我发现:
饼干排队没有为API请求启用,这就是为什么它不工作的原因。
我不得不与相应文件的中间件部添加:
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
适当文件或者应用/ HTTP/Kernel.php(使用Laravel API)或应用程序/配置/ API。 php
你救了我的命:) :) – Ali
壮观的答案! –