An object with user, isAuthenticated, loading, login, logout, and handleCallback.
Whether the user is fully authenticated.
true while user profile is loading after token exchange.
Initiate OAuth login — redirects to SoundCloud.
Log out and clear all auth state.
The authenticated user profile, or null.
Handle OAuth callback — exchange authorization code for tokens.
The authorization code from the callback URL.
The state parameter from the callback URL.
The token response from SoundCloud.
import { useSCAuth } from "soundcloud-api-ts-next";
function AuthButton() {
const { isAuthenticated, user, login, logout } = useSCAuth();
if (isAuthenticated) return <button onClick={logout}>Logout {user?.username}</button>;
return <button onClick={login}>Login with SoundCloud</button>;
}
Access SoundCloud OAuth authentication state and actions.
Provides the current user, login/logout functions, and a callback handler for completing the OAuth flow.