Skip to content

HTTP Error code 500 (K3s with keycloak as oidc provider) #22765

Closed

Description

@pppaapp

Describe the bug

CleanShot 2024-01-16 at 12 55 26@2x

CleanShot 2024-01-16 at 12 59 05@2x

If the web interface is accessed again after a period of time after logging in, a 500 error is output.

io.jsonwebtoken.ExpiredJwtException: JWT expired at 2024-01-16T03:29:09Z. Current time: 2024-01-16T03:58:40Z, a difference of 1768907 milliseconds.  Allowed clock skew: 3000 milliseconds.
	io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:448)
	io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:550)
	io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:610)
	io.jsonwebtoken.impl.ImmutableJwtParser.parseClaimsJws(ImmutableJwtParser.java:173)
	org.eclipse.che.multiuser.oidc.filter.OidcTokenInitializationFilter.processToken(OidcTokenInitializationFilter.java:80)
	org.eclipse.che.multiuser.api.authentication.commons.filter.MultiUserEnvironmentInitializationFilter.doFilter(MultiUserEnvironmentInitializationFilter.java:127)
	org.eclipse.che.commons.logback.filter.RequestIdLoggerFilter.doFilter(RequestIdLoggerFilter.java:50)
	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)

Che version

7.80@latest

Steps to reproduce

  1. open the link of che dashboard
  2. redirect to keycloak login page, enter username and password
  3. redirect to che dashboard
  4. 5 minutes later, che dashboard reports "HTTP Error code 500. Endpoint which throws an error https://example.com/api/kubernetes/namespace/provision. Check the browser logs message."

Expected behavior

.

Runtime

Kubernetes (vanilla)

Screenshots

No response

Installation method

chectl/latest

Environment

Linux

Eclipse Che Logs

No response

Additional context

No response

Activity

  1. added
    kind/bug
    on Jan 16, 2024
  2. changed the title [-]JWT expired earlier than reported (K8s with keycloak as oidc provider)[/-] [+]HTTP Error code 500 (K8s with keycloak as oidc provider)[/+] on Jan 16, 2024
  3. changed the title [-]HTTP Error code 500 (K8s with keycloak as oidc provider)[/-] [+]HTTP Error code 500 (K3s with keycloak as oidc provider)[/+] on Jan 16, 2024
  4. added
    status/need-triage
    on Jan 16, 2024
  5. pppaapp commented on Jan 16, 2024

    @pppaapp
    Author

    Deleting keycloak cookies resolves the issue

    But I can't keep deleting cookies every time something goes wrong...

  6. AObuchow commented on Jan 17, 2024

    @AObuchow

    @olexii4 @akurinnoy @tolusha any ideas here? I'm not yet too familiar with JWT's or ODIC providers

  7. added and removed
    status/need-triage
    on Jan 17, 2024
  8. akurinnoy commented on Jan 17, 2024

    @akurinnoy
    Contributor
  9. monaka commented on Feb 16, 2024

    @monaka
    Member

    Looks similar to #22130 and #21376 ?

  10. monaka commented on Feb 16, 2024

    @monaka
    Member

    @pppaapp
    I'm getting a same issue.

    Deleting keycloak cookies resolves the issue

    In my case, deleting the cookie _oauth2_proxy that is given from my Che instance resolves the issue. (not Keycloak's)

    Just guess: oauth2-proxy (in che-gateway) doesn't refresh cookie.

  11. monaka commented on Feb 17, 2024

    @monaka
    Member
  12. monaka commented on Feb 17, 2024

    @monaka
    Member

    A rough workaround for Keycloak admins:
    Increase Access Token Lifespan (and may SSO Session Idle also).
    Screenshot 2024-02-17 11 31 30

  13. monaka commented on Feb 18, 2024

    @monaka
    Member

    After some tries and errors, I got a little bit better workaround.

    Set cookieExpireSeconds shorter than Access Token Lifespan.

    For example:
    If "10 minutes" was set as your Access Token Lifespan in your realm.
    Set cookieExpireSeconds like follows.

    kind: CheCluster
    apiVersion: org.eclipse.che/v2
    spec:
      networking:
        auth:
          gateway:
            oAuthProxy:
              cookieExpireSeconds: 300
              # means 5 minutes (shorter than 10 minutes that is defined as `Access Token Lifespan`)
    
  14. tolusha commented on Feb 19, 2024

    @tolusha
    Contributor

    @monaka
    How to configure oauth2-proxy [1]
    [1] #22777 (comment)

  15. monaka commented on Feb 19, 2024

    @monaka
    Member

    @tolusha Thank you for your link.

    In this case, I think we can fix this (and related) issue by setting reasonable
    cookieExpreSeconds #22765 (comment) , without envvars.

    I lived in my Che (7.82.0-next) instance with fixed cookieExpireSeconds yesterday.
    It didn't reproduce this issue.

    Even though I don't see why issues are reported from uses that use Keycloak only, I suppose this issue can be closed as resolved.

  16. maheshrajrp commented on Feb 27, 2024

    @maheshrajrp

    Facing this same issue.
    @monaka I have a question, shouldn't this be resolved at client code, where Eclipse Che Dashboard Redirects and begins the SignIn work flow again ? Throwing an exception that doesn't convey any meaning to the user, or the possible actions they could try seems to be flawed ?

  17. added
    area/che-operator
    on Apr 9, 2024
  18. added
    area/install
    and removed
    area/che-operator
    on Sep 6, 2024
  19. added
    area/che-operator
    and removed
    area/install
    on Sep 19, 2024
  20. che-bot commented on Oct 22, 2025

    @che-bot
    Contributor

    Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

    Mark the issue as fresh with /remove-lifecycle stale in a new comment.

    If this issue is safe to close now please do so.

    Moderators: Add lifecycle/frozen label to avoid stale mode.

  21. added
    lifecycle/stale
    on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/che-operatorkind/buglifecycle/stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions