KDefaultTokenRefresher
Default KTokenRefresher implementation provided by Kindling.
Sends a POST to refreshUrl with { "refreshToken": "<token>" } and expects a { "accessToken": "...", "refreshToken": "..." } response.
Token application on retry is delegated to authProvider — so Bearer, ApiKey, Basic, Cookie, or any custom scheme all work without extra configuration.
If your refresh endpoint lives on a different server or expects a different request/response shape, implement KTokenRefresher directly instead.
Parameters
Full URL of the refresh endpoint. Can differ from KHttpConfig.baseUrl (e.g. a dedicated auth server).
Returns the current refresh token.
Called with (accessToken, refreshToken) on success. Persist the new tokens here.
Called when the refresh request fails or returns non-200. Clear the session here.
The same KAuthProvider passed to KHttpConfig.authProvider. Used to re-apply the auth header on the retried request after a successful refresh — works with any auth scheme.
Functions
Re-applies the auth credential to the retried request.
Called when refresh returned false or threw an exception.
Called before attempting a refresh.