asTokenProvider

fun asTokenProvider(leewaySeconds: Int = 60): TokenProvider

Returns a TokenProvider backed by this manager's cached token, refreshing it as needed.

Wire this into SpotifyClient or a domain *Apis class to get automatic token refresh on the data path. See getValidAccessToken for refresh behavior per grant and failure semantics.

Return

Token provider that resolves to a valid access token on every call.

Parameters

leewaySeconds

Safety window in seconds before actual expiration when the token is treated as expired.