It is not clear how to set User context in frontend and backend. It would be nice to have a recommendation.
For example in the server side hooks should every authenticated request set Sentry.setUser({ id: user!.id }) and clear it when unauthenticated (Sentry.setUser(null))?
How would this apply to client side? Should it be set or unset in a global layout.svelte?
Suggested Solution
Show a simple example of how to set/unset this information in server hooks and in a client side layout.svelte (if this is a recommended solution).
Core or SDK?
Platform/SDK
Which part? Which one?
Sveltekit
Description
It is not clear how to set User context in frontend and backend. It would be nice to have a recommendation.
For example in the server side hooks should every authenticated request set
Sentry.setUser({ id: user!.id })
and clear it when unauthenticated (Sentry.setUser(null)
)?How would this apply to client side? Should it be set or unset in a global layout.svelte?
Suggested Solution
Show a simple example of how to set/unset this information in server hooks and in a client side layout.svelte (if this is a recommended solution).
Additionally some info on things to avoid.