Skip to content

Commit aa6c59c

Browse files
committed
fix(auth): add fallback date parsing for SQLite format
Makes CLI robust against servers returning raw SQLite dates (YYYY-MM-DD HH:MM:SS) instead of RFC3339.
1 parent 540d170 commit aa6c59c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

internal/auth/login.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ func LoginInteractive(apiBase string) (*StoredAuth, error) {
7777

7878
expiresAt, err := time.Parse(time.RFC3339, result.ExpiresAt)
7979
if err != nil {
80-
return nil, fmt.Errorf("failed to parse expiration time: %w", err)
80+
// Fallback for SQLite datetime format (YYYY-MM-DD HH:MM:SS)
81+
// Assume UTC if no timezone info
82+
t, err2 := time.Parse("2006-01-02 15:04:05", result.ExpiresAt)
83+
if err2 == nil {
84+
expiresAt = t
85+
} else {
86+
return nil, fmt.Errorf("failed to parse expiration time '%s': %w (also tried SQLite format: %v)", result.ExpiresAt, err, err2)
87+
}
8188
}
8289

8390
stored := &StoredAuth{

0 commit comments

Comments
 (0)