Replies: 1 comment 6 replies
-
According to the fetch documentation:
Your export async function GET(event) {
const cookie = event.request.headers.get("cookie") || ""
const response = await fetch('http://api/protected', {credentials:'include', headers: {cookie}})
... |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation on the fetch APIs says:
Similarly, the load function documentation says:
I am using a package that handles authentication in the browser and stores the JWT in memory. Until now when I have been making async HTTP requests I manually set the
Authorization
header and verify the token in my endpoints. What I am trying to figure out is how to set the sameAuthorization
header when requesting a page route itself so that it will be inherited by the load function.As a follow-up, I also cannot find any documentation around how to pass through
credentials
to a page endpoint instead of manually writing a script withcontext="module"
.Beta Was this translation helpful? Give feedback.
All reactions