Get Zone Authorization Token Info
zone.getAuthorizationTokenInfo
Returns the authenticated account address and token expiry from the current authorization token.
Usage
import { } from './viem.config'
const = await ..()
.('Account:', .)
.('Expires At:', .)
Account: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbbExpires At: 1717027200nimport { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Re-Sign Before the Token Expires
Combine the token expiry with zone.signAuthorizationToken to refresh authentication in a long-running service before zone requests start failing.
import { } from './viem.config'
const { } = await ..()
const = 60n * 60n
const = (.(.() / 1000))
if ( - < )
await ..()import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = {
/** Authenticated account address. */
account: Address
/** Token expiry as a unix timestamp. */
expiresAt: bigint
}The authorization token info.