Arnav
Arnav
BABetter Auth
Created by Arnav on 2/28/2025 in #help
getSession Headers Type
I'm trying to access the user session from an endpoint in my express server:
app.post('/print_auth', async (req: Request, res: Response) => {
const session = await auth.api.getSession({
headers: req.headers,
});
console.log(session);
res.json({ success: true });
});
app.post('/print_auth', async (req: Request, res: Response) => {
const session = await auth.api.getSession({
headers: req.headers,
});
console.log(session);
res.json({ success: true });
});
However, the type that getSession expects for headers is Headers, but the type express gives me is IncomingHttpHeaders. How do I fix this?
4 replies