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

    Function refreshUserToken

    • Refresh an expired access token using a refresh token (refresh_token grant).

      This is a standalone function alternative to SoundCloudClient.Auth.refreshUserToken.

      Parameters

      • clientId: string

        Your SoundCloud application's OAuth client ID

      • clientSecret: string

        Your SoundCloud application's OAuth client secret

      • redirectUri: string

        The redirect URI registered with your SoundCloud application

      • refreshToken: string

        The refresh token from a previous token response

      Returns Promise<SoundCloudToken>

      A new OAuth token response with fresh access and refresh tokens

      When the refresh token is invalid or expired

      import { refreshUserToken } from 'soundcloud-api-ts';

      const newToken = await refreshUserToken(
      'YOUR_CLIENT_ID',
      'YOUR_CLIENT_SECRET',
      'https://example.com/callback',
      oldRefreshToken,
      );
      console.log(newToken.access_token);