Best way for a plugin to extend session object
We’re trying to extend the session object in the
What’s the recommended way to safely extend the session object with custom attributes while maintaining type safety?
We came across the
after hook using createAuthMiddleware. However, when we fetch the session on the client, it still uses the original session type.What’s the recommended way to safely extend the session object with custom attributes while maintaining type safety?
We came across the
customSession plugin, which overrides the /get-session route — but is that really the recommended approach for all plugins? It feels a bit hacky for something that should be more common.Solution
Yeah I would recommend a new endpoint if using customSession isn't an option for you.