Exchange a refresh token for a new grant token while the underlying grant remains active. Refresh tokens are single-use, and each successful rotation returns a new refresh token without extending ExpiresAt.
tokenResp, err := client.Tokens.Refresh(ctx, grantex.RefreshTokenParams{ RefreshToken: "current-refresh-token", AgentID: "agent-id", // Persist this with the old token until the response is durable. IdempotencyKey: refreshAttemptID,})// tokenResp.RefreshToken is a NEW refresh token — store it// tokenResp.ExpiresAt is the same grant expiration
Always store and use the newest RefreshToken. Retry a lost response with the same previous token and IdempotencyKey. The SDK retains an omitted key for five minutes in the current process, but a restarted caller must restore an explicit persisted key. After the window, once the rotated child token has been used, or after grant expiration, the previous refresh token is rejected.