init() needs to run in the browser (not on the server), wrap it in a Client Component.
1. Create the component
init() is a no-op on the server — it checks for window internally. You don’t need a typeof window !== 'undefined' guard.Adding user identity (recommended)
Create a second Client Component to callidentify() once your session is available: