Log in without the need for the browser extension - #49
Conversation
- Fix coordinator AttributeError: pass config entry to PostNLCoordinator - Fix wrong base class: SensorEntity instead of Entity - Fix None guard on coordinator.data in handle_coordinator_data - Fix AttributeError on ClientError.status: guard with isinstance check - Remove OAuth access token from debug log (security) - Fix async_setup_entry return type annotation: True -> bool - Fix misleading log message in async_unload_entry - Add requests to manifest requirements - Add SensorStateClass.MEASUREMENT to both sensors - Add DeviceEntryType.SERVICE and configuration_url to DeviceInfo - Replace old-style state/unit_of_measurement/icon properties with native_value and _attr_ class variables Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add auth.py: full PKCE + Janrain Capture login flow using aiohttp, token refresh, no browser redirect required - Replace OAuth2FlowHandler with a plain ConfigFlow (username/password) and reauth confirm step - Replace AsyncConfigEntryAuth OAuth2Session wrapper with direct token management from the config entry; raises ConfigEntryAuthFailed on auth failure to stop the retry loop - Catch HomeAssistantError in coordinator and convert to UpdateFailed - Add receiverTitle to GraphQL shipment fragment and Package struct - Remove application_credentials dependency from manifest and delete application_credentials.py - Add translations/en.json so config flow strings render in the UI - Add docs/api/ with full reference for login, userinfo, GraphQL and Track & Trace endpoints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
If the refresh token is missing or rejected, attempt a full re-login using the stored credentials before triggering a reauth notification. This silently recovers from expired or rotated refresh tokens without requiring user intervention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@peternijssen, This PR caught my attention as I'd love to see some auth-flow improvements myself. I cannot speak on behalf of the maintainer of this component, but some feedback that may still be applicable here (and most definately for the other PR you've opened): Please keep PRs limited to only the singe feature you're adding and do not include other PRs that have not yet been merged. |
|
Unfortunately Several parts depend on each other. It's up to the maintainer so I will adjust accordingly once he let's me know how to continue. |
I prefer smaller scoped MR, which can be linked to each other and review them in a sequence. |
|
To be honest, I am not comfortable with bypassing the whole oauth2 flow from a user-perspective. Also, when something changes on PostNL's side, then the whole integration will break. I also don't like the browser extension, but maybe we can find another approach? |
This merges #48 and #52 as well as presenting a new authentication flow, which does not require the browser extension.
More info can be found here, where I requested people to test it out:
https://community.home-assistant.io/t/postnl-and-dhl-nl-integration/112433/524
Closes #6 and might influence #43