Skip to content

fix(auth): resolve V2 API 429 rate limit during authentication#34

Draft
mattpetters wants to merge 1 commit intodev-mirzabicer:mainfrom
mattpetters:fix/v2-auth-429-rate-limit
Draft

fix(auth): resolve V2 API 429 rate limit during authentication#34
mattpetters wants to merge 1 commit intodev-mirzabicer:mainfrom
mattpetters:fix/v2-auth-429-rate-limit

Conversation

@mattpetters
Copy link
Copy Markdown

Summary

Fixes #33 - V2 API returns 429 rate limit during client.connect() after fresh OAuth flow.

Root Cause

TickTick added rate limiting at their AWS ELB level that blocks requests missing proper browser headers. The SDK's minimal header approach was being flagged as bot traffic.

Changes

  • Add Origin: https://ticktick.com header (required)
  • Add Referer: https://ticktick.com/ header (required)
  • Update X-Device header to match web app format with full device info
  • Update web app version from 6430 to 8010

Investigation

Headers were identified by:

  1. Capturing a working auth request from ticktick.com via Chrome DevTools
  2. Comparing against the SDK implementation
  3. Testing minimal header sets via curl to identify the required ones

Testing

Verified fix works with:

  • Direct Python SDK connection test
  • MCP server startup
2026-02-05 14:18:48,257 - httpx - INFO - HTTP Request: POST https://api.ticktick.com/api/v2/user/signon?wc=true&remember=true "HTTP/1.1 200 "
2026-02-05 14:18:48,257 - ticktick_sdk.api.v2.auth - INFO - Successfully authenticated user: ...

@mattpetters mattpetters marked this pull request as draft February 5, 2026 22:20
The V2 API signon endpoint now requires additional headers to avoid
429 rate limiting at the AWS ELB level:

- Add Origin: https://ticktick.com header
- Add Referer: https://ticktick.com/ header
- Update X-Device header to use full web app format (os, device, channel, etc.)

The version number in X-Device is NOT strictly validated - the original
6430 works fine. The key fix is the Origin/Referer headers and the full
X-Device structure.

Fixes dev-mirzabicer#33
@mattpetters mattpetters force-pushed the fix/v2-auth-429-rate-limit branch from 3c63359 to 23f4ab5 Compare February 5, 2026 22:25
TWDickson added a commit to TWDickson/ticktick-sdk that referenced this pull request Mar 9, 2026
- Add Origin: https://ticktick.com header
- Add Referer: https://ticktick.com/ header
- Update X-Device header to web app format with full device info
- Update User-Agent to Chrome 120.0

Fixes upstream issue dev-mirzabicer#33, based on PR dev-mirzabicer#34 by mattpetters
hardane pushed a commit to hardane/ticktick-sdk that referenced this pull request Mar 16, 2026
- auth.py & client.py: Mimic real browser headers (Chrome UA, Origin,
  Referer, full x-device) to avoid TickTick's AWS ELB rate limiting.
  Ref: dev-mirzabicer#34

- task.py: Add field_validator for repeat_from to handle string/empty
  values from TickTick API (e.g. "0", "1", "").
  Ref: dev-mirzabicer#29

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

V2 API returns 429 rate limit during client.connect() after fresh OAuth flow

1 participant