Files
hassio-integration-perfectd…/custom_components/perfectdraft/translations/en.json
T
rick fcba32fecd Replace reCAPTCHA auth with token-bootstrap flow
The Android reCAPTCHA Enterprise key cannot be used from any
non-Android context (browser, server, headless). Certificate
pinning prevents MITM token capture. Every approach to bypass
reCAPTCHA has been exhausted.

New approach: user provides UserId + RefreshToken (one-time
extraction from the PerfectDraft app via HTTP Toolkit or similar).
The integration validates by calling /auth/renewaccesstokens,
which does NOT require reCAPTCHA, then refreshes forever.

Changes:
- config_flow.py: two-step flow (email, then tokens), validates
  via refresh endpoint, reauth asks for fresh tokens
- api.py: refresh_access_token() calls /auth/renewaccesstokens
  with {UserId, RefreshToken}, removed authenticate() method,
  added x-api-key header to all authenticated requests
- const.py: added CONF_USER_ID, removed reCAPTCHA constants
- __init__.py: passes user_id to client.set_tokens()
- strings.json + translations: updated for new flow steps
- Deleted recaptcha.py and static/recaptcha.html
- test_harness.py: updated for refresh-based flow

Made-with: Cursor
2026-04-12 12:26:12 +02:00

49 lines
1.4 KiB
JSON

{
"config": {
"step": {
"user": {
"title": "PerfectDraft Account",
"description": "Enter the email address associated with your PerfectDraft account.",
"data": {
"email": "Email"
}
},
"tokens": {
"title": "API Tokens",
"description": "Enter your UserId and RefreshToken from the PerfectDraft app. See the integration documentation for instructions on how to extract these.",
"data": {
"user_id": "User ID",
"refresh_token": "Refresh Token"
}
},
"reauth_confirm": {
"title": "Re-authenticate PerfectDraft",
"description": "Your session has expired. Please enter fresh tokens from the PerfectDraft app.",
"data": {
"user_id": "User ID",
"refresh_token": "Refresh Token"
}
}
},
"error": {
"invalid_auth": "Invalid or expired tokens. Please extract fresh tokens from the PerfectDraft app.",
"cannot_connect": "Cannot connect to PerfectDraft service.",
"unknown": "An unexpected error occurred."
},
"abort": {
"already_configured": "This PerfectDraft account is already configured.",
"reauth_successful": "Re-authentication successful."
}
},
"options": {
"step": {
"init": {
"title": "PerfectDraft Options",
"data": {
"scan_interval": "Polling interval (seconds)"
}
}
}
}
}