soundcloud-api-ts - v1.9.0
    Preparing search index...

    Function getAuthorizationUrl

    • Build the SoundCloud authorization URL for the OAuth 2.1 code flow.

      Redirect the user to this URL so they can grant access to your application.

      Parameters

      • clientId: string

        Your SoundCloud application's OAuth client ID

      • redirectUri: string

        The redirect URI registered with your SoundCloud application

      • Optionaloptions: { codeChallenge?: string; state?: string }

        Optional parameters for the authorization request

        • OptionalcodeChallenge?: string

          PKCE S256 code challenge for enhanced security

        • Optionalstate?: string

          Opaque state value for CSRF protection (round-tripped by SoundCloud)

      Returns string

      The full authorization URL to redirect the user to

      import { getAuthorizationUrl, generateCodeVerifier, generateCodeChallenge } from 'soundcloud-api-ts';

      const verifier = generateCodeVerifier();
      const challenge = await generateCodeChallenge(verifier);
      const url = getAuthorizationUrl('YOUR_CLIENT_ID', 'https://example.com/callback', {
      state: 'random-csrf-token',
      codeChallenge: challenge,
      });
      // Redirect user to `url`