diff --git a/cmd/auth.go b/cmd/auth.go index 2526d38..c2162a2 100644 --- a/cmd/auth.go +++ b/cmd/auth.go @@ -121,7 +121,7 @@ func runAuth(cmd *cobra.Command, args []string) error { logger.Debug("Time until expiry", logger.Args("time_until_expiry", timeUntilExpiry)) logger.Debug("Expires at", logger.Args("expires_at", tokens.ExpiresAt)) if timeUntilExpiry < 24*time.Hour { - pterm.Warning.Printf("⚠️ Access token expires in %s\n", timeUntilExpiry.Round(time.Minute)) + pterm.Warning.Printf("⚠️ Access token expires in %s\n", timeUntilExpiry.Round(time.Second)) } else { pterm.Success.Printf("✓ Access token valid for %s\n", timeUntilExpiry.Round(time.Second)) } diff --git a/pkg/auth/oauth.go b/pkg/auth/oauth.go index 6fdde58..7743229 100644 --- a/pkg/auth/oauth.go +++ b/pkg/auth/oauth.go @@ -271,6 +271,9 @@ func RefreshTokens(ctx context.Context, tokens *TokenStorage) (*TokenStorage, er values.Set("refresh_token", tokens.RefreshToken) values.Set("client_id", ClientID) values.Set("scope", DefaultScope) + if tokens.OrgID != "" { + values.Set("org_id", tokens.OrgID) + } // Make the token request manually to ensure client_id is included req, err := http.NewRequestWithContext(ctx, "POST", TokenURL, strings.NewReader(values.Encode())) @@ -316,6 +319,7 @@ func RefreshTokens(ctx context.Context, tokens *TokenStorage) (*TokenStorage, er AccessToken: newToken.AccessToken, RefreshToken: newToken.RefreshToken, ExpiresAt: newToken.Expiry, + OrgID: tokens.OrgID, }, nil }