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

    Interface SoundCloudServerClientConfig

    Configuration for createSoundCloudServerClient.

    interface SoundCloudServerClientConfig {
        clientId: string;
        clientSecret: string;
        getToken?: () => string | Promise<string | undefined> | undefined;
        onRequest?: (telemetry: SCRequestTelemetry) => void;
        onRetry?: (info: RetryInfo) => void;
    }
    Index

    Properties

    clientId: string

    SoundCloud OAuth client ID from your app registration.

    clientSecret: string

    SoundCloud OAuth client secret from your app registration.

    getToken?: () => string | Promise<string | undefined> | undefined

    Optional function that returns the current user's access token.

    When provided, the returned client automatically passes the token to authenticated API calls (e.g. /me, /me/likes). Return undefined to fall back to client-credentials (public API calls only).

    Can be async — useful when reading from cookies, headers, or a session store.

    const sc = createSoundCloudServerClient({
    clientId: process.env.SC_CLIENT_ID!,
    clientSecret: process.env.SC_CLIENT_SECRET!,
    getToken: () => cookies().get("sc_access_token")?.value,
    });
    onRequest?: (telemetry: SCRequestTelemetry) => void

    Called after every SoundCloud API request with structured telemetry. Useful for logging, metrics, and tracing.

    onRetry?: (info: RetryInfo) => void

    Called on each retry attempt before the request is retried.