How do I control what data goes into .session_data cookie
Hi everyone! I've been integrating Better Auth with Payload CMS and have a question about controlling the data in the .data_session cookie.
I've successfully used the customSession plugin to control what user data is returned from getSession:
However, this doesn't seem to affect what gets stored in the .data_session cookie itself. I've added some extra fields to my user object that I don't want to expose if someone base64 decodes the cookie.
Is there a way to control specifically what user data gets serialized into the .data_session cookie? Or is this functionality planned for a future release?
Thanks in advance!
1 Reply
I've written a custom adapter for Payload CMS which works great (as far as I tested), so if I need to I could fix it at that level if possible.
Found the solution: