User Management
Overview
Kritzel comes with a whole set of user management features, such as configurable login dialogs and user profile handling. While the editor provides the UI and event hooks, your application is responsible for performing the actual authentication and managing user state.
Configuring Providers
To enable Kritzel's user management features, provide a loginConfig with at least one authentication provider. This renders the login button at the top right of <KritzelEditor> and displays the login dialog with a button for each configured provider.
Handling the Login
Clicking a provider button puts that button into a loading state and invokes the editor's onLogin callback with a LoginEvent. Your application performs the sign-in and then sets the controlled user prop accordingly.
Handling the Logout
When the user selects the logout action, <KritzelEditor> invokes onLogout. Your application should clear the controlled user prop and update its authentication state.
Setting the User
Use the user prop for the logged-in user and activeUsers for workspace collaborators. The current user drives the account UI and awareness metadata, while active users appear as avatars in the editor header. Both props update at runtime, so clearing user signs out and replacing activeUsers refreshes the collaborator list.
API Details
For the full list of related APIs, see the following reference sections.