Open SilviaAmAm opened 1 month ago
This happens because the ID token has expired and this code path is hit: https://github.com/mozilla/mozilla-django-oidc/blob/2c2334fdc9b2fc72a492b5f0e990b4c30de68363/mozilla_django_oidc/middleware.py#L131
The expiration interval is by default 15 min (https://github.com/mozilla/mozilla-django-oidc/blob/2c2334fdc9b2fc72a492b5f0e990b4c30de68363/mozilla_django_oidc/views.py#L58)
What happens is:
landingLoader
is called.getStatusMap
: https://github.com/maykinmedia/open-archiefbeheer/blob/b03a1de1be635004d32e8ce70a9935f2c6adf2dd/frontend/src/pages/landing/Landing.loader.tsx#L21getStatusMap
makes a request to the backend https://github.com/maykinmedia/open-archiefbeheer/blob/b03a1de1be635004d32e8ce70a9935f2c6adf2dd/frontend/src/pages/landing/Landing.loader.tsx#L32What would be the correct behavior here, should we catch the exception and then redirect somewhere? How do we obtain a new id token?
The correct behaviour would be to redirect to the /login
page I think, so that the user can log in again :thinking:
Let's discuss it some times this week
Investigated the setting OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS
: https://github.com/mozilla/mozilla-django-oidc/blob/2c2334fdc9b2fc72a492b5f0e990b4c30de68363/docs/installation.rst#validate-id-tokens-by-renewing-them
This is the setting that causes the token expiry and it defaults to 15 min.
If this and the SESSION_COOKIE_AGE
are the same, then we should be okay.
Reproducing
backend/docker-services/keycloak
withdocker compose up
.base.py
)OIDC_RENEW_ID_TOKEN_EXPIRY_SECONDS
= 0.oidc_config_test.json
in the backendhttp://localhost:3000/login
) and login with OIDC.http://localhost:3000/
This should cause a crash :thinking:To do
Frontend
Backend