Vitor-Avila commented on code in PR #37398:
URL: https://github.com/apache/superset/pull/37398#discussion_r2733429058
##########
superset/utils/oauth2.py:
##########
@@ -96,10 +99,20 @@ def refresh_oauth2_token(
user_id=user_id,
database_id=database_id,
):
- token_response = db_engine_spec.get_oauth2_fresh_token(
- config,
- token.refresh_token,
- )
+ try:
+ token_response = db_engine_spec.get_oauth2_fresh_token(
+ config,
+ token.refresh_token,
+ )
+ except Exception:
+ # If token refresh failed, delete the invalid token to prevent
retry loops
+ logger.warning(
+ "OAuth2 token refresh failed for user=%s db=%s, deleting
invalid token",
+ user_id,
+ database_id,
+ )
+ db.session.delete(token)
+ return None
Review Comment:
thanks! addressed
--
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]