From 8a68d34ec3cd85ea7950c8bf27b8cff0c51d6e5f Mon Sep 17 00:00:00 2001 From: Jose Antonio Insua Date: Fri, 27 Feb 2026 17:26:42 +0100 Subject: [PATCH] Remove dead TokenInfo.Expires field and broken calculations The Expires field was set in jwt_exchange.go, exchange.go, and refresh.go but never read by any caller. The calculations were also wrong: duration * duration produces nanoseconds-squared (overflow), and refresh.go used time.Second while the others used time.Millisecond. Remove the field entirely rather than fixing dead code. Co-Authored-By: Claude Opus 4.6 --- ims/config.go | 1 - ims/exchange.go | 2 -- ims/jwt_exchange.go | 1 - ims/refresh.go | 3 +-- 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/ims/config.go b/ims/config.go index 371f468..8500eca 100644 --- a/ims/config.go +++ b/ims/config.go @@ -52,7 +52,6 @@ type Config struct { // Access token information type TokenInfo struct { AccessToken string - Expires int //(response.ExpiresIn * time.Millisecond), Valid bool Info string } diff --git a/ims/exchange.go b/ims/exchange.go index 6bd1d43..c1405d4 100644 --- a/ims/exchange.go +++ b/ims/exchange.go @@ -12,7 +12,6 @@ package ims import ( "fmt" - "time" "github.com/adobe/ims-go/ims" ) @@ -62,6 +61,5 @@ func (i Config) ClusterExchange() (TokenInfo, error) { return TokenInfo{ AccessToken: r.AccessToken, - Expires: int(r.ExpiresIn * time.Millisecond), }, nil } diff --git a/ims/jwt_exchange.go b/ims/jwt_exchange.go index a1d7ba2..42a91f4 100644 --- a/ims/jwt_exchange.go +++ b/ims/jwt_exchange.go @@ -61,6 +61,5 @@ func (i Config) AuthorizeJWTExchange() (TokenInfo, error) { return TokenInfo{ AccessToken: r.AccessToken, - Expires: int(r.ExpiresIn * time.Millisecond), }, nil } diff --git a/ims/refresh.go b/ims/refresh.go index 185a258..82ce08e 100644 --- a/ims/refresh.go +++ b/ims/refresh.go @@ -12,8 +12,8 @@ package ims import ( "fmt" + "github.com/adobe/ims-go/ims" - "time" ) func (i Config) validateRefreshConfig() error { @@ -56,7 +56,6 @@ func (i Config) Refresh() (RefreshInfo, error) { return RefreshInfo{ TokenInfo: TokenInfo{ AccessToken: r.AccessToken, - Expires: int(r.ExpiresIn * time.Second), }, RefreshToken: r.RefreshToken, }, nil