Skip to content

Keycloak provider gives 500 on expired access token #59277

@Ilardi

Description

@Ilardi

Apache Airflow version

Other Airflow 2/3 version (please specify below)

If "Other Airflow 2/3 version" selected, which one?

3.1.4

What happened?

I have the same issue described in #56614.
When i make a request to the Airflow API using a valid Airflow token that contains an expired access token from Keycloak i receive a 500 internal server error instead of 401/403 or such. I thought the issue would be fixed in 3.1.4 but apparently it is not.

What you think should happen instead?

The application should not raise an exception but it should handle it with an appropriate http response code.

How to reproduce

  1. Create a token at /auth/token
  2. Wait 5 minutes (or whatever the access token expiration date is) and make a request to the Airflow API using that token

Operating System

Ubuntu 24.04.1 LTS

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

I use this Dockerfile to build a custom image:
FROM apache/airflow:3.1.4
USER airflow
COPY requirements.txt /
RUN pip install --no-cache-dir "apache-airflow==${AIRFLOW_VERSION}" -r /requirements.txt

The package installed from requirements is apache-airflow-providers-keycloak
I am using keycloak:26.4.0

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions