-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookies don't work when using an Elysia instance #126
Comments
@SaltyAom Could you look at this? This is blocking a lot of my tests. |
@facundo-villa I'm using Elysia v1.1.26 and Eden v1.1.3. I have set up the /auth/login Routeexport const authRoute = new Elysia().post('/auth/login', async ({ body, cookie: { auth } }) => {
const { accessToken } = await someClient.login(body.email, body.password);
auth.set({ priority: 'high', value: accessToken });
return { ok: true };
}, {
body: t.Object({ email: t.String(), password: t.String() }),
cookie: t.Cookie({
auth: t.Optional(t.String()),
}, {
httpOnly: true,
sameSite: 'strict',
secrets: process.env['COOKIE_SECRET'],
secure: true,
sign: ['auth'],
}),
}); /me Routeexport const meRoute = new Elysia().get('/me', ({ cookie: { auth } }) => {
console.log(auth);
const dataFromDatabase = ...;
return dataFromDatabase;
}, {
cookie: t.Cookie({ auth: t.String() }, {
httpOnly: true,
sameSite: 'strict',
secrets: process.env['COOKIE_SECRET'],
secure: true,
sign: ['auth'],
}),
}); Try updating the packages to the latest versions. |
This is still fails for me. I might've not made it abundantly clear in my original posts, but this issue arises during integration tests. The actual application web application does work correctly. |
Cookies don't get sent to subsequent requests when using Eden with an Elysia instance. Even when
credentials: include
is set.I'm using Elysia version
1.1.9
and Eden1.1.2
I expect set credential cookies to be sent to subsequent request, as to be able to correctly test endpoints that need authentication and/or tokens.
Cookies do work correctly when performing actual requests to the server from another HTTP client.
Sample code:
The text was updated successfully, but these errors were encountered: