Skip to content

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

Open
avolk201 wants to merge 7 commits into
guillevc:masterfrom
avolk201:fix/relax-trakt-client-id-validation
Open

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

Conversation

@avolk201

Copy link
Copy Markdown

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 added 7 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
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

1 participant