Skip to content

Commit 210e127

Browse files
committed
fix: Trim API token on read to avoid accidental line break issues
1 parent 810f995 commit 210e127

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

auth/token.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ func NewTokenClient() *TokenClient {
7373
func (tc *TokenClient) GetToken() (Token, error) {
7474
tokenType := tc.GetTokenType()
7575
if tokenType != BearerToken {
76-
return Token{Type: tokenType, Value: os.Getenv(EnvVarCloudQueryAPIKey)}, nil
76+
tokenFromEnv := os.Getenv(EnvVarCloudQueryAPIKey)
77+
trimmedToken := strings.TrimSpace(tokenFromEnv)
78+
return Token{Type: tokenType, Value: trimmedToken}, nil
7779
}
7880

7981
// If the token is not expired, return it

0 commit comments

Comments
 (0)