LogoRobo.js
Packages@robojs/auth

switchSession()

Function: switchSession()

function switchSession(userId, options?): Promise<SwitchSessionResult>

Switches the active session to the given user.

Parameters

ParameterTypeDescription
userIdstringThe user ID to switch to (must exist in the device session stack).
options?ClientOptionsOverrides for base path, headers, or a custom fetch implementation.

Returns

Promise<SwitchSessionResult>

A result indicating success or the reason for failure.

Example

const result = await switchSession('user-id-123')
if (result.ok) window.location.reload()

On this page