Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/auth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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
}

Expand Down