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

    Interface SoundCloudRoutesConfig

    Configuration for initializing server-side SoundCloud API route handlers.

    import { createSoundCloudRoutes } from "soundcloud-api-ts-next/server";

    const sc = createSoundCloudRoutes({
    clientId: process.env.SC_CLIENT_ID!,
    clientSecret: process.env.SC_CLIENT_SECRET!,
    redirectUri: "http://localhost:3000/api/soundcloud/auth/callback",
    });

    createSoundCloudRoutes for usage

    interface SoundCloudRoutesConfig {
        clientId: string;
        clientSecret: string;
        getToken?: () => Promise<string>;
        redirectUri?: string;
    }
    Index

    Properties

    clientId: string

    SoundCloud OAuth client ID from your app registration.

    clientSecret: string

    SoundCloud OAuth client secret from your app registration.

    getToken?: () => Promise<string>

    Custom token provider for public (non-auth) routes. When set, this function is called instead of the default client-credentials flow. Useful when your app stores OAuth tokens externally (e.g. Redis, database).

    Type Declaration

      • (): Promise<string>
      • Returns Promise<string>

        A valid SoundCloud access token string.

    const sc = createSoundCloudRoutes({
    clientId: process.env.SC_CLIENT_ID!,
    clientSecret: process.env.SC_CLIENT_SECRET!,
    getToken: async () => {
    const redis = await getRedisClient();
    return redis.get("sc:token");
    },
    });
    redirectUri?: string

    OAuth redirect URI — required if using authentication features (login/callback).