OAuthAuthorizationProvider
class OAuthAuthorizationProvider(initialAccessToken: String, refreshTokenHandler: suspend () -> String?) : AuthorizationProvider
An AuthorizationProvider that holds an OAuth bearer access token and refreshes it via refreshTokenHandler. Mirrors SwiftyNetwork's OAuthAuthorizationProvider.
Concurrent refreshes are coalesced: if several requests 401 at once, refreshTokenHandler runs exactly once and all callers await the same result — the Kotlin analog of SwiftyNetwork's in-flight refresh Task, and of Novalingo's sign-in mutex choke point.
Parameters
initialAccessToken
the token to start with.
refreshTokenHandler
mints a fresh access token, or returns null if refresh failed.
Functions
Link copied to clipboard
The current access token.
Link copied to clipboard
The authorization to attach to the next request.
Link copied to clipboard
Attempts to refresh the credential after a 401. Returns true if a fresh credential is now available (and the request should be retried), false otherwise.