soundcloud-api-ts-next
    Preparing search index...

    Interface PkceStore

    Pluggable storage backend for PKCE verifiers.

    The default implementation keeps verifiers in-process memory, which is fine for single-instance Node.js deployments but will break on serverless/multi-instance setups (Vercel, edge, etc.) due to cold-starts and instance hopping.

    Supply a custom store via SCAuthManagerConfig.pkceStore to use an external store (Redis, signed cookies, etc.) that survives across instances.

    // Redis adapter example
    const redisStore: PkceStore = {
    async set(state, verifier, ttlMs) {
    await redis.set(`pkce:${state}`, verifier, { px: ttlMs });
    },
    async get(state) {
    return (await redis.get(`pkce:${state}`)) ?? undefined;
    },
    async delete(state) {
    await redis.del(`pkce:${state}`);
    },
    };
    interface PkceStore {
        delete(state: string): void | Promise<void>;
        get(state: string): string | Promise<string | undefined> | undefined;
        set(state: string, verifier: string, ttlMs: number): void | Promise<void>;
    }

    Implemented by

    Index

    Methods

    Methods

    • Remove the entry for state (one-time-use enforcement).

      Parameters

      • state: string

      Returns void | Promise<void>

    • Retrieve the verifier for state, or undefined if absent/expired.

      Parameters

      • state: string

      Returns string | Promise<string | undefined> | undefined

    • Store a verifier keyed by state, expiring after ttlMs milliseconds.

      Parameters

      • state: string
      • verifier: string
      • ttlMs: number

      Returns void | Promise<void>