OAuthTokens

@Serializable
data class OAuthTokens(val accessToken: String, val refreshToken: String? = null, val expiresAtMs: Long? = null, val idToken: String? = null, val accountId: String? = null, val email: String? = null)(source)

Tokens from an OAuth sign-in. Persist them encrypted (the demo uses SecretStore); never log them.

Constructors

Link copied to clipboard
constructor(accessToken: String, refreshToken: String? = null, expiresAtMs: Long? = null, idToken: String? = null, accountId: String? = null, email: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard

provider account the API needs alongside the token (e.g. ChatGPT's workspace id), taken from the ID token.

Link copied to clipboard
Link copied to clipboard

wall-clock expiry of accessToken, if the server said.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun expiresSoon(nowMs: Long = System.currentTimeMillis(), slackMs: Long = 5 * 60_000L): Boolean

True when the access token is expired or about to be (default 5 minutes of slack).

Link copied to clipboard
open override fun toString(): String