Your SoundCloud application's OAuth client ID
The redirect URI registered with your SoundCloud application
Optionaloptions: { codeChallenge?: string; state?: string }Optional parameters for the authorization request
OptionalcodeChallenge?: stringPKCE S256 code challenge for enhanced security
Optionalstate?: stringOpaque state value for CSRF protection (round-tripped by SoundCloud)
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`
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.