Headers for fetch
I'm trying to use browser's
fetch()
to access a custom API end point /api/test
, but it doesn't include auth headers.
This works (using better fetch from authClient):
This does not (using browser's fetch):
So fetch needs something from a session. What do I need to add to headers?
It is a Vue app, using Hono for API.1 Reply
Solution
Solved. Added
{ credentials: 'include' }
to second parameter to fetch