TokenData

class TokenData(val id: String, val tokenType: String, val expiresIn: Int, val accessToken: String, val scope: String?, val refreshToken: String?, val idToken: String?, val deviceSecret: String?, val issuedTokenType: String?, val configuration: OAuth2ClientConfiguration, val issuedAt: Long = configuration.clock.currentTimeEpochSecond() - expiresIn) : TokenInfo

Default cross-platform implementation of TokenInfo.

Used on JVM and other non-Android KMP targets where the Android-specific Token is not available.

Constructors

Link copied to clipboard
constructor(id: String, tokenType: String, expiresIn: Int, accessToken: String, scope: String?, refreshToken: String?, idToken: String?, deviceSecret: String?, issuedTokenType: String?, configuration: OAuth2ClientConfiguration, issuedAt: Long = configuration.clock.currentTimeEpochSecond() - expiresIn)

Properties

Link copied to clipboard
open override val accessToken: String

The access token.

Link copied to clipboard
open override val clientId: String

The client id of the application that minted this token.

Link copied to clipboard
Link copied to clipboard
open override val deviceSecret: String?

The device secret, if requested.

Link copied to clipboard
open override val expiresIn: Int

The expiration duration in seconds for this token.

Link copied to clipboard
open override val id: String

Unique identifier for this token.

Link copied to clipboard
open override val idToken: String?

The ID token, if requested.

Link copied to clipboard

Epoch-second timestamp when the token was issued by the authorization server.

Link copied to clipboard
open override val issuedTokenType: String?

The issued token type, if returned.

Link copied to clipboard
open override val issuerUrl: String

The issuer url of the token.

Link copied to clipboard
open override val refreshToken: String?

The refresh token, if requested.

Link copied to clipboard
open override val scope: String?

The scopes granted when this token was minted.

Link copied to clipboard
open override val tokenType: String

The string type of the token (e.g. Bearer).

Functions

Link copied to clipboard

Returns the access token string if it has not expired, or null if it has.

Link copied to clipboard
fun copy(id: String = this.id, refreshToken: String? = this.refreshToken, deviceSecret: String? = this.deviceSecret): TokenData

Creates a copy with optionally replaced fields.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Equality is based on the token payload fields only (tokenType, expiresIn, accessToken, scope, refreshToken, idToken, deviceSecret, issuedTokenType).

Link copied to clipboard
open override fun hashCode(): Int