PerfectDraft's Cognito PreAuthentication Lambda now requires a "domain" field in ClientMetadata. The api.perfectdraft.com /authentication/sign-in gateway does not forward it, so every setup and reauth failed with "PreAuthentication failed with error 'domain'" (#11, #12, #13). authenticate() now calls Cognito InitiateAuth (USER_PASSWORD_AUTH) itself, the endpoint token refresh already uses. A failed sign-in now says what was rejected and why. A wrong email or password returns to the credentials form; a rejected token stays on the token step; both show Cognito's reason instead of the old blanket "token may have expired", which hid this outage. The README snippet copies the token to the clipboard. It captures copy() up front because Chromium removes it once the console command returns. Root cause and fix by @cesa030 in #11; confirmed in @brettjenkins' fork. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
912 B
Python
30 lines
912 B
Python
DOMAIN = "perfectdraft"
|
|
|
|
API_BASE_URL = "https://api.perfectdraft.com"
|
|
API_KEY = "cAyzERqthCJXYVExjNAhr9CzE8ncLN2cQK3WGK10"
|
|
|
|
RECAPTCHA_SITE_KEY = "6LcZQiUoAAAAAAO3JUjLiT470c-pNXbWyepuvMtV"
|
|
RECAPTCHA_ACTION = "Magento/login"
|
|
# PerfectDraft's Cognito PreAuthentication Lambda rejects sign-in without it.
|
|
RECAPTCHA_DOMAIN = "https://www.perfectdraft.com"
|
|
|
|
COGNITO_REGION = "eu-west-1"
|
|
COGNITO_CLIENT_ID = "57ddq2ppqg2jcpup06r2g1deur"
|
|
|
|
DEFAULT_SCAN_INTERVAL = 900 # 15 minutes
|
|
MIN_SCAN_INTERVAL = 60 # 1 minute
|
|
|
|
CONF_REFRESH_TOKEN = "refresh_token"
|
|
CONF_ACCESS_TOKEN = "access_token"
|
|
CONF_ID_TOKEN = "id_token"
|
|
CONF_USER_ID = "user_id"
|
|
CONF_MACHINE_ID = "machine_id"
|
|
CONF_SCAN_INTERVAL = "scan_interval"
|
|
|
|
PLATFORMS = ["sensor", "button"]
|
|
|
|
|
|
def keg_changed_signal(machine_id: str) -> str:
|
|
"""Dispatcher signal fired when the keg is manually marked as changed."""
|
|
return f"{DOMAIN}_keg_changed_{machine_id}"
|