You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ! I am experiencing an issue with session cookies being sent in subsequent requests but my user cannot be authenticated using AdonisJS with session authentication. Here is the detailed setup and the problem I am facing:
However, when making a subsequent GET request to /auth, the cookie is sent in the request headers, but the session is not recognized on the server-side:
The session cookie is present in the request headers, but auth.check() fails to authenticate the user.
Questions :
Is there a potential issue with how auth.check() handles the session cookie?
Are there any additional configurations or middleware setups required to ensure the session is recognized in subsequent requests?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi ! I am experiencing an issue with session cookies being sent in subsequent requests but my user cannot be authenticated using AdonisJS with session authentication. Here is the detailed setup and the problem I am facing:
**Setup : **
Front-end (Next.js):
LoginForm Component:
Test Component:
Back-end (AdonisJS):
session.ts Configuration:
cors.ts Configuration:
Login Route:
Test Route :
Problem:
After logging in, the session cookie is set correctly, as shown in the response headers:
Set-Cookie: adonis-session=s%3AeyJtZXNzYWdlIjoiY2x5NjhlMnozMDAwbHpnNGZhcDZrOW53bSIsInB1cnBvc2UiOiJhZG9uaXMtc2Vzc2lvbiJ9.9UvYwoIEesoBAYaLDo2_VBgh1Yw5UhU52du8BWEp-XI; Max-Age=7200; Path=/; HttpOnly; SameSite=None
However, when making a subsequent GET request to /auth, the cookie is sent in the request headers, but the session is not recognized on the server-side:
Cookie: adonis-session=s%3AeyJtZXNzYWdlIjoiY2x5NjhlMnozMDAwbHpnNGZhcDZrOW53bSIsInB1cnBvc2UiOiJhZG9uaXMtc2Vzc2lvbiJ9.9UvYwoIEesoBAYaLDo2_VBgh1Yw5UhU52du8BWEp-XI
The session cookie is present in the request headers, but auth.check() fails to authenticate the user.
Questions :
Is there a potential issue with how auth.check() handles the session cookie?
Are there any additional configurations or middleware setups required to ensure the session is recognized in subsequent requests?
Thank you for your help and support!
Beta Was this translation helpful? Give feedback.
All reactions