-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Describe the bug
Sessions don't restore automatically on http request. Logic for this is commented in the transport.js . As discussed on the call, this is due to the fact that transport.js previously had access to the client, but now it has been changed and therefore it is simply commented out, and nothing new has been written to do automatically sessions restoring. Instead, this logic is implemented in the files like auth/provider.js/restoreSession or auth/restore.js in business logic, but metacom.d.ts also doest have restore method, so Its like a small conflict.
I think it should happen automatically in init() function on this.httpServer.on('request') in server.js, but the main problem that we need to read session from db when our session store doest have received session token. So in this case the best option, in my opinion, will be just to call method readSession from client duo this.application.getMethod('auth', '*', 'restore') or something like this.
So to make the long story short, we need add restore method to metacom.d.ts and leave the logic for session restoring to the client. Or make it on http request as explained in the last paragraph.
To Reproduce
Just try to send a request for private method without restoring session manual.
Expected behavior
Restoring will happen automatically when I send a request with session in cookies
Desktop (please complete the following information):
- OS: macOs Sonoma 14.2.1
- Node.js version 20