mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(db oauth2): Improve OAuth2 flow (#39499)
This commit is contained in:
@@ -368,6 +368,27 @@ class OAuth2RedirectError(SupersetErrorException):
|
||||
)
|
||||
|
||||
|
||||
class OAuth2TokenRefreshError(OAuth2RedirectError):
|
||||
"""
|
||||
Raised when an OAuth2 refresh token request fails with a 400/401/403 error.
|
||||
The stored token is no longer valid and the user must re-authenticate.
|
||||
|
||||
Subclasses OAuth2RedirectError so that existing oauth2_exception checks
|
||||
match it automatically, triggering start_oauth2_dance() via check_for_oauth2.
|
||||
"""
|
||||
|
||||
def __init__(self, response_text: str) -> None:
|
||||
SupersetErrorException.__init__(
|
||||
self,
|
||||
SupersetError(
|
||||
message="OAuth2 token refresh failed, re-authentication required.",
|
||||
error_type=SupersetErrorType.OAUTH2_REDIRECT,
|
||||
level=ErrorLevel.WARNING,
|
||||
extra={"error": response_text},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class OAuth2Error(SupersetErrorException):
|
||||
"""
|
||||
Exception for when OAuth2 goes wrong.
|
||||
|
||||
Reference in New Issue
Block a user