Skip to content

Commit 6c0d37d

Browse files
Update ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e35ffe2 commit 6c0d37d

File tree

1 file changed

+10
-0
lines changed
  • ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers

1 file changed

+10
-0
lines changed

ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/providers/BearerAuthProvider.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public class BearerAuthConfig {
6060
internal var loadTokens: suspend () -> BearerTokens? = { null }
6161
internal var sendWithoutRequest: (HttpRequestBuilder) -> Boolean = { true }
6262

63+
/**
64+
* Determines whether tokens should be cached after being loaded or refreshed.
65+
* When set to `true` (default), tokens are cached and reused until explicitly cleared or refreshed.
66+
* When set to `false`, tokens are loaded fresh on every request.
67+
*
68+
* Set this to `false` if you need to obtain a new token for each request,
69+
* for example when using short-lived tokens or when token state is managed externally.
70+
*
71+
* [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.client.plugins.auth.providers.BearerAuthConfig.cache)
72+
*/
6373
public var cache: Boolean = true
6474
public var realm: String? = null
6575

0 commit comments

Comments
 (0)