• Sets the authentication tokens and calculates expiry time

    Parameters

    • newAccessToken: string

      Access token from Spotify

    • newRefreshToken: string

      Refresh token from Spotify

    • expiresIn: number

      Token expiry time in seconds

    Returns void

    export function setTokens(
    newAccessToken: string,
    newRefreshToken: string,
    expiresIn: number,
    ): void {
    accessToken = newAccessToken;
    refreshToken = newRefreshToken;
    tokenExpiryTime = Date.now() + expiresIn * 1000;

    saveLog(`Spotify tokens updated, expires in ${expiresIn} seconds`, "DEBUG");
    }