Skip to main content
Quepass.init() is the first call your application must make. It authenticates the operator channel, completes the RSA handshake with the backend, and stores a session token for all subsequent API calls. The Quepass Agent Kiosk calls init() on the Welcome page every time the user returns to the home route or the page regains visibility.

init() Parameters

ParameterTypeRequiredDescription
emailstringYesOperator email address registered with Quepass.
passwordstringYesOperator password.
channelIdstringYesChannel identifier issued by the Quepass team.
baseUrlstringYesRoot URL of the Quepass backend — no trailing slash.

init() Response

// Success
{ code: 200, data: { sessionId: string; token: string } }

// Failure
{ code: number, errors: [{ code: string | number; message: string }] }

Code Example  (Welcome.tsx)

The reference app calls init() then immediately calls getConfigurations():
import { Quepass } from '@quepass/sdk';

const initializeSdk = async (formData, themeMode = 'light') => {
  // 1. Apply theme before init (optional)
  Quepass.setTheme({ mode: themeMode });

  // 2. Initialize
  const initResponse = await Quepass.init(
    formData.email,
    formData.password,
    formData.channel,    // channelId
    formData.baseUrl
  );

  if (initResponse?.code === 200) {
    // 3. Fetch channel configuration
    const config = await Quepass.getConfigurations();

    if (config?.code === 200) {
      const data = config.data;

      // Store session expiry
      const expiry = Date.now() + Number(data.s_SessionTimeout) * 60_000;
      sessionStorage.setItem('sessionExpiration', expiry.toString());

      // Persist configuration for use across routes
      localStorage.setItem('configuration', JSON.stringify(data));

      // Gate feature buttons by allowed journeys
      const allowedJourneys = data.allowedJourneys as string[];
      setAllowedJourneys(allowedJourneys);
      setIsDisabled(false);   // unlock UI
    } else {
      setInitError(config?.errors?.[0]?.message ?? 'Failed to get configurations');
    }
  } else if (initResponse?.code === 401) {
    setInitError(initResponse?.errors?.[0]?.message ?? 'Authentication failed.');
  } else {
    setInitError(initResponse?.errors?.[0]?.message ?? 'Initialization failed.');
  }
};
sessionStorage is cleared before each re-initialization to ensure the old session token is not reused.