Replies: 1 comment
-
Well for bearer tokens, you need to manually attach the token in the Authorization header:
And then you could do const authorizationHeader = req.headers.get("Authorization");
if (authorizationHeader === null) {
res.writeHeader(401);
return;
}
const parts = authorizationHeader.split(" ");
if (parts.length !== 2 || (parts[0] !== "Bearer") {
res.writeHeader(401);
return;
}
const sessionToken = parts[1]; (this doesn't use a specific API) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First off, thanks for making this library! I'm new to this and it really helped me learn a lot setting up auth.
For authenticating api side, what is the best way to do it? From what I understand, most uses Bearer token in the request headers, but how can I retrieve the Bearer token from lucia and attach it when the client is fetching data from the API? It doesn't exist when I console.log(req) even though I'm logged in.
Sorry if I asked some dumb questions, but appreciate any help!
Beta Was this translation helpful? Give feedback.
All reactions