Skip to content

Send login headers on v1 web login requests (#413) - #414

Merged
RealCLanger merged 1 commit into
pytr-org:masterfrom
phatloi0010:fix-v1-login-headers
Nov 2, 2026
Merged

RealCLanger merged 1 commit into
pytr-org:masterfrom
phatloi0010:fix-v1-login-headers

Conversation

@phatloi0010

Copy link
Copy Markdown
Contributor

Summary

Trade Republic started enforcing the X-TR-Device-Info header check on POST /api/v1/auth/web/login as well: requests without _login_headers() now receive:

{"errors": [{"errorCode": "MISSING_REQUIRED_HEADER", "errorMessage": null, "meta": null}]}

with HTTP status 400 Bad Request (even when a valid aws-waf-token cookie obtained via Playwright is present).

Previously, initiate_weblogin(), resend_weblogin(), and complete_weblogin() only attached self._login_headers() when self._use_v2_login was enabled. Sending self._login_headers() on the v1 web login requests as well satisfies the header check and restores the default v1 login flow.

Fixes #413

Testing

  • Verified against https://api.traderepublic.com/api/v1/auth/web/login with a Playwright WAF token that omitting X-TR-Device-Info returns 400 MISSING_REQUIRED_HEADER whereas including _login_headers() passes header validation.
  • Added test_every_v1_login_call_sends_the_required_headers in tests/test_api_urls.py.
  • pytest, ruff check, ruff format --check, and mypy . all pass.

LoicSERRE added a commit to LoicSERRE/finalibaba-selfhosted that referenced this pull request Nov 2, 2026
…150)

Trade Republic now rejects a v1 web login without X-TR-Device-Info (400
MISSING_REQUIRED_HEADER, pytr-org/pytr#413). pytr only sends its login
headers on v2; new_tr_api adds them to the session until
pytr-org/pytr#414 lands.

@RealCLanger RealCLanger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I already feared that TR dropped the V1 login API. Thanks for the contribution.

@RealCLanger
RealCLanger merged commit 85f7657 into pytr-org:master Nov 2, 2026
5 checks passed
LoicSERRE added a commit to LoicSERRE/finalibaba-selfhosted that referenced this pull request Nov 3, 2026
pytr now sends its login headers on v1 too (#147), so the local
workaround goes. The v1 header test now runs against pytr itself.
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.

probable change at TR 400 Client Error: Bad Request for url: https://api.traderepublic.com/api/v1/auth/web/login

2 participants