Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Kinde · Type Alias

SessionManager

SessionManager is the Kinde TypeScript SDK interface for storing authentication-session data. Implement it with a key-value store and pass the adapter to SDK authentication methods.

How it works

SessionManager is an application-provided storage adapter for the Kinde TypeScript SDK. Implement its asynchronous operations with a key-value store so the SDK can preserve authenticated-session data between requests.

Syntax

interface SessionManager { getSessionItem(key: string): Promise<unknown>; setSessionItem(key: string, value: unknown): Promise<void>; removeSessionItem(key: string): Promise<void>; destroySession(): Promise<void>; }

Parameters

NameTypeDescription
keystringThe key used to retrieve, store, or remove session data.
valueunknownThe session value to store.

Returns

The page specifies asynchronous methods but does not state explicit return types.

Key points

  • The SDK needs a session store to preserve authentication state across separate requests.
  • Back the adapter with any key-value store as long as it implements the documented interface.
  • getSessionItem asynchronously retrieves the value associated with a string key.
  • setSessionItem asynchronously stores an unknown value under a string key.
  • removeSessionItem asynchronously removes the value associated with a string key.

Common mistakes

  • The adapter is only an interface contract; production applications should connect these methods to a durable session store rather than rely on process memory.

Example: In-memory session manager

import type { SessionManager } from "@kinde/js-utils";

const sessions = new Map<string, unknown>();

const sessionManager: SessionManager = {
  async getSessionItem(key) {
    return sessions.get(key);
  },
  async setSessionItem(key, value) {
    sessions.set(key, value);
  },
  async removeSessionItem(key) {
    sessions.delete(key);
  },
  async destroySession() {
    sessions.clear();
  },
};

This in-memory implementation satisfies the SDK contract for reading, writing, deleting, and clearing session data.

When to use it

Track authenticated requests

A server-rendered or backend TypeScript application needs authentication state retained between HTTP requests.

Connect persistent storage

An application uses Redis, a database, or another external key-value system for session storage.

Prototype with memory

A small local prototype needs a minimal working adapter without adding an external dependency.

Interview questions

QWhat problem does SessionManager solve?

SessionManager is the storage abstraction that lets the SDK track an authenticated session between requests. The application supplies implementations for reading, writing, removing one item, and destroying the session.

Follow-up: What storage can back it? Any key-value store is suitable, provided it implements the required interface methods.

QWhat operations must an implementation provide?

getSessionItem reads a value by key, setSessionItem writes a value, removeSessionItem deletes one key, and destroySession clears the session store. Each operation is asynchronous.

Follow-up: Why make the methods asynchronous? The contract can support remote or otherwise asynchronous session stores instead of only in-memory objects.

QHow is SessionManager passed to the Kinde client?

The SDK receives the adapter when authentication operations such as login are invoked. For example, the documentation shows kindeClient.login(sessionManager) and uses the adapter to retain session state.

Follow-up: What changes when using a persistent store? The method behavior remains the same, but data can survive process restarts and be shared across application instances.

  • kindeClient.login
  • kindeClient.register
  • session store
  • SessionManager interface

Source: TypeScript. Checked 2026-10-15.