Reputation: 225
I have a Laravel API that uses passport, what i need is to set the access to the Set-Cookie header, but the problem is it that my response does not contain any, and i having this warning 'Provisional headers are shown in my request headers.
im using HttpClient in angular to request for the data
This is the response that should contain a cookie
return response()->json([
"status" => "ok",
"message" => "good to go"
])->cookie('test','sampledata');
this is the RESPONSE Header im getting
Cache-Control: no-cache, private
Connection: close
Content-Type: application/json
Date: Mon, 11 Mar 2019 12:12:13 +0000, Mon, 11 Mar 2019 12:12:13 GMT
Host: localhost:8080
Vary: Origin
X-Powered-By: PHP/7.2.11
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
Upvotes: 0
Views: 637
Reputation: 5552
Routes in your api
middleware group are stateless and do not run the session or cookie middleware. If you need a route that sets cookies, your best option is to define it in routes/web.php
instead.
Upvotes: 2