Skip to main content

User sessions

When loading your application, you might want to check if the user already has a session.

To do so, you can use the getUserSession API

getUserSession(): Promise<User | null>#

Returns null if no session exists, or a User if they are logged in.


This API also works for anonymous users


const client = new CollabClient({ ... });
const checkLogin = async () => {
const user = await client.getUserSession();
if(user) {
window.location.href = `/profile/${}`;
} else {
window.location.href = '/login';