feat: add OAuth support for cloud APIs - #563
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Warning
Important issues found.
- Token exchange sends no client authentication and no PKCE — and the helper signature can't express either
- Unknown-model diagnostic loses the payload that exists to add new device support
|
Thanks for the detailed review. I addressed the diagnostic and error-handling findings in On the OAuth wire contract: there is not currently a public SwitchBot OAuth document I can link. The implementation follows the SwitchBot-provisioned public-client flow used by the current consumer. Changes made from the review:
The token returned by this flow is expected directly in the SwitchBot internal account endpoints' Local result: |
Verified PKCE point accepted as a documented server limitation, not re-raised as blocking. Residual risk stays real: an intercepted code remains redeemable by anyone. Worth documenting that Two follow-ups from this pass. README line 89 still quotes |
PR Review — feat: add OAuth support for cloud APIsAll previously blocking findings are resolved or dismissed by the author; what remains is documentation drift and error-taxonomy polish. Merge-ready. Verified fixed since the last review: the unknown-model diagnostic is back to logging the full item payload with an unmasked MAC ( Still the strongest part of this PR:
✅ Resolved since last review (3)Previously-flagged issues verified fixed
🟢 Suggestions
1. README troubleshooting quotes an error message the key path no longer emits
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
Human responsible: @zerzhang.
Summary
OAuth wire contract
state;statedoes not replace PKCE.authorizationheader expected by the SwitchBot internal account endpoints.Error semantics
HTTP 401 and 403 responses now surface as
SwitchbotAuthenticationError, including on the pre-existing password flow. Other provider API failures surface asSwitchbotApiError; transport and service-availability failures useSwitchbotAccountConnectionError.Testing
poetry run pytest --cov=switchbot testsswitchbot/oauth.pyand the new shared request-ID helper are fully covered