Guy-Lev commented on code in PR #64219:
URL: https://github.com/apache/airflow/pull/64219#discussion_r2990379837
##########
airflow-core/src/airflow/api_fastapi/core_api/security.py:
##########
@@ -123,6 +127,9 @@ async def resolve_user_from_token(token_str: str | None) ->
BaseUser:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED,
detail="Token Expired")
except InvalidTokenError:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,
detail="Invalid JWT token")
+ except Exception:
+ log.exception("Unexpected error during token authentication")
Review Comment:
@bugraoz93 thanks for the quick review.
If the general approach is approved by @pierrejeambrun, I’ll start improving
the PR accordingly and remove the logs (a unit test exists
[here](https://github.com/apache/airflow/pull/64219/changes#diff-d37cc720dd2821fc2ad6b54165c77a1007ab422c133a4d3c8596476ee4a2457fR114)).
In my case, the specific reproduction scenario was a missing Bearer prefix
in the token_string, which made it difficult to understand what was wrong with
our API request. It took some time to realize it was related to the
authentication header.
--
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]