I was wondering if anybody tried auth authentication with astro's api-endpoints using auth-astro? I was hoping we could do something like
// pages/api/create.json.ts
import { getSession } from 'auth-astro/server';
export async function get({ params, request }) {
const session = await getSession(request);
return {
...
};
}
and then fetch it like
// pages/index.astro
---
const response = await (
await fetch('http://localhost:3030/api/projects/create.json', { credentials: 'same-origin' })
).json();
---
but then session is undefined in pages/api/create.json.ts.