Skip to content

fix: relax Trakt Client ID validation to accept new format - #21

Merged
guillevc merged 9 commits into
guillevc:masterfrom
avolk201:fix/relax-trakt-client-id-validation
Aug 3, 2026
Merged

fix: relax Trakt Client ID validation to accept new format#21
guillevc merged 9 commits into
guillevc:masterfrom
avolk201:fix/relax-trakt-client-id-validation

Conversation

@avolk201

Copy link
Copy Markdown
Contributor

Problem

Trakt has changed their API key format. New Client IDs generated from the updated application creation page are no longer 64-character lowercase hex strings — they can be shorter (e.g. 43 characters) and contain uppercase letters, underscores, and hyphens.

The current validation regex (/^[0-9a-f]{64}$/) rejects these new-format Client IDs, making it impossible for users to connect their Trakt accounts.

Solution

Relaxed the validation regex in both the shared Zod schema (used by the frontend form and tRPC router) and the server-side Value Object (used when loading from persistence) to accept alphanumeric strings with underscores and hyphens, requiring a minimum of 20 characters.

New regex: /^[0-9a-zA-Z_-]{20,}$/

This accepts both:

  • Legacy format: 64-character lowercase hex strings (e.g. a1b2c3d4....)
  • New format: Shorter alphanumeric strings with underscores (e.g. the 43-character IDs reported in the issue)

Files Changed

  • packages/shared/src/presentation/schemas/trakt.schema.ts — Relaxed Zod schema regex
  • packages/server/src/domain/value-objects/trakt-client-id.vo.ts — Relaxed server-side persistence validation

Fixes #19

avolk201 and others added 9 commits July 27, 2026 10:46
Trakt has changed their API key format. New Client IDs are no longer
restricted to 64-character lowercase hex strings — they can be shorter
(e.g. 43 characters) and contain uppercase letters, underscores, and
hyphens.

Updated the validation regex in both the shared Zod schema (used by
the frontend form and tRPC router) and the server-side Value Object
(used when loading from persistence) to accept alphanumeric strings
with underscores/hyphens, requiring a minimum of 20 characters.

Fixes guillevc#19
Watchlist URLs with sort but no media filter produced
/watchlist/all/... which is not a valid Trakt API path.
Drop sort when no type filter is present.

cd.yaml had the PR branch in the push trigger and a
fix-trakt Docker tag that would become dead config on merge.
@guillevc
guillevc merged commit 0a523af into guillevc:master Aug 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to connect to trakt using client id

2 participants