dosubot[bot] commented on issue #40811: URL: https://github.com/apache/superset/issues/40811#issuecomment-4634100915
<!-- Answer --> Hi @zeckem19! I'm [Dosu](https://go.dosu.dev/dosubot) and I'm helping the Apache Superset team. Your analysis of the regression is accurate — `raise_for_status()` added in PR #37350 raises `requests.exceptions.HTTPError`, which doesn't match `oauth2_exception` (`OAuth2RedirectError`), so the stale token is never deleted and the OAuth2 dance never restarts. The good news is **this has already been fixed** in two subsequent PRs: 1. **PR #37398** (merged 2026-01-31) — initial fix targeting Google Sheets by catching `HTTPError` with status 400 / `invalid_grant` and converting it to an appropriate exception [[1]](https://github.com/apache/superset/pull/37398). 2. **PR #39499** (merged 2026-04-21) — centralized fix for **all** database providers. It introduces a new `OAuth2TokenRefreshError` (subclass of `OAuth2RedirectError`) raised when the IdP returns HTTP 400/401/403, ensuring the stored token is deleted and the OAuth2 dance restarts [[2]](https://github.com/apache/superset/pull/39499) [[3]](https://github.com/apache/superset/pull/39499#L832-L835). The current `get_oauth2_fresh_token` in `base.py` no longer uses a blanket `raise_for_status()`; instead it checks specific status codes and raises `OAuth2TokenRefreshError` which is properly caught by the existing handler . So if you upgrade to a release that includes PR #39499 (post-6.1.0), this issue should be resolved. If you're stuck on 6.1.0, the suggested fix in your report (catch `HTTPError` / detect `invalid_grant`, delete the token, re-raise as `oauth2_exception`) is essentially what was implemented. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=0071b24a-f389-4b68-b206-038ce4b31b3c) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
