TokenData

@Serializable
data class TokenData(val accessToken: String, val apiKey: String, val expiresIn: Int, val tokenType: String, val refresh: TokenRefreshInfo? = null)

令牌数据 包含访问令牌信息(签名交换接口返回) 注意:accessToken 和 apiKey 是两个不同的值

官方文档:vds-docs/基础接口/签名交换.md

字段说明(对应官方 API 响应字段):

  • accessToken: 访问令牌,用于 Authorization: Bearer 认证头

  • apiKey: API 密钥,用于 X-Api-Key 认证头

  • expiresInSeconds: 令牌有效期(秒),默认 3600(1 小时)

  • tokenType: 令牌类型,通常为 "Bearer"

  • appId: 应用 ID(格式 vap_xxxx)

  • grants: 授权范围列表

  • refresh: 可选的令牌刷新信息(签名换新时返回)

响应示例:

{
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"apiKey": "eyJhbGciOiJIUzI1NiIs...",
"tokenType": "Bearer",
"expiresInSeconds": 3600,
"appId": "vap_xxxxxxxxxxxxxxxx",
"grants": ["furtv", "furtv.gathering.timeline"],
"requestId": "6ff8d966-b3f6-46a6-9fe3-24fd6553ef52"
}

Constructors

Link copied to clipboard
constructor(accessToken: String, apiKey: String, expiresIn: Int, tokenType: String, refresh: TokenRefreshInfo? = null)

Properties

Link copied to clipboard

访问令牌,用于 Authorization: Bearer 认证头

Link copied to clipboard

API 密钥,用于 X-Api-Key 认证头

Link copied to clipboard
@SerialName(value = "expiresInSeconds")
val expiresIn: Int

令牌有效期(秒)

Link copied to clipboard
@SerialName(value = "refresh")
val refresh: TokenRefreshInfo? = null

可选的令牌刷新信息

Link copied to clipboard

令牌类型,通常为 "Bearer"