Optimize in 8.8-alpha7 with separately setup Keycloak and identity from core component

Hi,

I installed a fresh 8.8-alpha7 with a separate Keycloak instance connected to Identity via OpenIDC. Operate and Identity work fine, but for Optimize I get a redirect loop between Optimize and Keycloak. Any idea what the issue might be? I am trying to use the agentic feature and see the isntances in optimize, but can’t get it to work.

Thanks in advance!

Hi there! :waving_hand:

I can help you troubleshoot this redirect loop issue with Optimize and Keycloak in Camunda 8.8-alpha7. This is a known type of authentication configuration issue that typically stems from misconfigured redirect URIs or client settings.

Key Areas to Check

1. Redirect URI Configuration

The most common cause of redirect loops is incorrect redirect URI configuration. For Optimize, ensure you have:

In Keycloak client settings:

https://<OPTIMIZE_URL>/api/authentication/callback

In your Helm values (if using Helm):

global:
  identity:
    auth:
      optimize:
        redirectUrl: https://<OPTIMIZE_URL>

:warning: Important: The redirect URI must match exactly between Keycloak and your Camunda configuration.

2. Client Configuration in Keycloak

Verify your Optimize client in Keycloak has:

  • :white_check_mark: Client enabled
  • :white_check_mark: Valid client secret set
  • :white_check_mark: Access type set to “confidential”
  • :white_check_mark: Correct audience (typically optimize-api or the client ID)

3. Common Configuration Issues

  • HTTP/HTTPS mismatch: Ensure all URLs use the same protocol (preferably HTTPS)
  • Wrong callback path: Must be /api/authentication/callback for Optimize
  • Cookie/session issues: Domain, path, or secure flag problems can prevent authentication persistence

4. Debug Logging

To get more insight into what’s happening, enable debug logging for Optimize:

logging:
  level:
    com.camunda.optimize: DEBUG

This will help trace where the authentication flow is failing.

Next Steps

  1. Double-check your redirect URI configuration in both Keycloak and your Camunda setup
  2. Verify client secret and audience settings are consistent
  3. Enable debug logging to see detailed authentication flow information
  4. Check for HTTP/HTTPS consistency across all URLs

Since you mentioned Operate and Identity work fine, the issue is likely specific to the Optimize client configuration rather than the overall OIDC setup.

Could you share:

  • Your relevant Helm values (redacted of sensitive info) or environment configuration for Optimize?
  • The Keycloak client configuration for Optimize?
  • Any specific error messages from the Optimize logs?

This will help me provide more targeted assistance!

References:

The error message in optimize is:

2025-08-25 08:01:44.880 DEBUG 8 — [nio-8090-exec-7] c.o.r.s.c.CCSMAuthenticationCookieFilter : Authenticating null

2025-08-25 08:01:44.880 DEBUG 8 — [nio-8090-exec-7] c.o.r.s.c.CCSMAuthenticationCookieFilter : No pre-authenticated principal found in request

the redirect url for optimize has been checked. also the valid redirect url in keycloak matches the description with “/api/authentication/callback” at the end of the redirect url configured for optimize in the values.yaml file.

Thanks for providing those debug logs! The error “No pre-authenticated principal found in request” from CCSMAuthenticationCookieFilter indicates that Optimize is not receiving or recognizing the authentication cookie after the Keycloak login process.

Since you’ve confirmed the redirect URLs are correctly configured, this is likely a cookie handling issue. Here are the specific solutions to try:

:cookie: Cookie Configuration Fix

The most common cause of this specific error is the SameSite cookie setting. You need to disable SameSite cookies for Optimize:

Add this to your Optimize configuration:

environment:
  - CAMUNDA_OPTIMIZE_SECURITY_AUTH_COOKIE_SAME_SITE_ENABLED=false

Or in Helm values:

optimize:
  env:
    - name: CAMUNDA_OPTIMIZE_SECURITY_AUTH_COOKIE_SAME_SITE_ENABLED
      value: "false"

This is especially important when using ingress controllers or reverse proxies, as they can interfere with cookie handling in cross-site scenarios.

:magnifying_glass_tilted_left: Additional Checks

1. Issuer URL Consistency

Verify that the issuer URL in your Optimize configuration exactly matches what Keycloak provides:

# Should match your Keycloak realm issuer URL
CAMUNDA_OPTIMIZE_IDENTITY_ISSUER_URL: "https://your-keycloak-domain/auth/realms/your-realm"

2. Client Secret Configuration

Ensure your Optimize client in Keycloak is:

  • :white_check_mark: Enabled
  • :white_check_mark: Access Type: confidential
  • :white_check_mark: Valid client secret provided to Optimize

3. Protocol Consistency

Make sure all URLs (Keycloak, Optimize, Identity) use the same protocol (HTTPS recommended).

:wrench: Debugging Steps

  1. Check browser network tab during login to see if cookies are being set
  2. Verify cookie domain/path settings in browser dev tools
  3. Enable more detailed logging for authentication:
    logging:
      level:
        com.camunda.optimize.service.security: DEBUG
        org.springframework.security: DEBUG
    

:bullseye: Most Likely Solution

Based on the specific error you’re seeing, setting CAMUNDA_OPTIMIZE_SECURITY_AUTH_COOKIE_SAME_SITE_ENABLED=false should resolve the issue. This is a common requirement for Optimize when using external OIDC providers like Keycloak.

Try this configuration change first and let me know if the redirect loop persists!

References:

unfortunately that did not help: also it seems to be already configured via environment-config.yaml:

security:
auth:
cookie:
same-site:
enabled: false

Thanks for confirming the SameSite cookie setting is already configured. Since the standard solutions haven’t resolved the issue, let’s dive deeper into the authentication configuration.

:magnifying_glass_tilted_left: Advanced Troubleshooting Steps

1. Verify Core Authentication Parameters

Please check these critical Optimize environment variables in your configuration:

# Issuer URL - must match exactly what Keycloak provides
CAMUNDA_OPTIMIZE_IDENTITY_ISSUER_URL: "https://your-keycloak-domain/auth/realms/your-realm"
CAMUNDA_OPTIMIZE_IDENTITY_ISSUER_BACKEND_URL: "https://your-keycloak-domain/auth/realms/your-realm"

# Client credentials
CAMUNDA_OPTIMIZE_IDENTITY_CLIENTID: "optimize"
CAMUNDA_OPTIMIZE_IDENTITY_CLIENTSECRET: "your-client-secret"
CAMUNDA_OPTIMIZE_IDENTITY_AUDIENCE: "optimize-api"  # or your client ID

2. JWT Token Validation

The “No pre-authenticated principal found” error often indicates JWT token validation issues. Verify:

  • Issuer URL accessibility: Optimize container must be able to reach the issuer URL
  • JWT claims matching: The iss and aud claims in the JWT must match your configuration
  • Token expiration: Check if tokens are expiring too quickly

3. Enhanced Debug Logging

Add more specific logging to trace the authentication flow:

logging:
  level:
    com.camunda.optimize.service.security: DEBUG
    org.springframework.security: DEBUG
    org.springframework.security.oauth2: DEBUG
    org.springframework.web.filter: DEBUG

4. Network Connectivity Test

Since this is a fresh 8.8-alpha7 installation, verify network connectivity:

# From within the Optimize container, test if you can reach the issuer
curl -v "https://your-keycloak-domain/auth/realms/your-realm/.well-known/openid_configuration"

5. Keycloak Client Configuration Double-Check

In your Keycloak Optimize client, ensure:

  • :white_check_mark: Access Type: confidential
  • :white_check_mark: Standard Flow Enabled: ON
  • :white_check_mark: Valid Redirect URIs: https://your-optimize-url/api/authentication/callback
  • :white_check_mark: Web Origins: https://your-optimize-url

:police_car_light: Alpha Version Consideration

Since you’re using 8.8-alpha7, this could be a version-specific issue. Alpha releases may have authentication bugs that aren’t present in stable versions.

:clipboard: Information Needed

To provide more targeted help, could you share (with sensitive data redacted):

  1. Your complete Optimize authentication configuration from environment-config.yaml
  2. Keycloak client configuration for Optimize (screenshots or export)
  3. Full debug logs during the authentication attempt
  4. Network setup details (ingress, load balancer, etc.)

:bullseye: Next Steps

  1. Enable the enhanced debug logging above
  2. Test network connectivity from Optimize to Keycloak
  3. Verify JWT token claims match your configuration
  4. Consider testing with a stable version (8.7.x) to isolate if this is an alpha-specific issue

If the issue persists after these checks, this might be a bug specific to 8.8-alpha7 that needs to be reported to the Camunda team.

References:

When I set it up with Identity and Keycloak installed via Camunda Helm chart it works, but I try to use the setup of having a separate keycloak without being populated with information from identity. I am using the plain openidc connection between the new identity of the core component and keycloak.

@micudaj - can you share your values.yaml perhaps? I have never tried using Keycloak as the OIDC provider; rather, because Identity already integrates with Keycloak natively, I’ve always configured it that way.

Hi Niall,

Thanks for you quick reply!
Type is still Keycloak. But I have to create all clients myself if I run the “new” identity integrated into core, or am I misunderstanding it?

this is the current values.yaml I am using:

global:
  security:
    authentication:
      method: oidc
  ingress:
    enabled: true
    annotations:
      nginx.ingress.kubernetes.io/enable-global-auth: 'false'
    host: "camunda-alpha.domain.de"
    tls:
      enabled: true
      secretName: camunda-alpha-tls
  identity:
    service:
      url: "https://camunda-alpha.domain.de/core/identity"
    keycloak:
      contextPath: "/auth"
      adminUser: admin
      existingSecret: keycloak-secret
      passwordSecretKey: kc_admin_password
    auth:
      enabled: true
      issuer: "https://camunda-alpha.domain.de/auth/realms/camunda-platform"
      issuerBackendUrl: "https://camunda-alpha.domain.de/auth/realms/camunda-platform"
      tokenUrl: "https://camunda-alpha.domain.de/auth/realms/camunda-platform/protocol/openid-connect/token"
      jwksUrl: "https://camunda-alpha.domain.de/auth/realms/camunda-platform/protocol/openid-connect/certs"
      type: "KEYCLOAK"
      publicIssuerUrl: "https://camunda-alpha.domain.de/auth/realms/camunda-platform"
      admin:
        enabled: true
        clientId: admin
        existingSecret: 
          name: identity-secret-for-components
        existingSecretKey: admin-client-token
      identity:
        redirectUrl: "https://camunda-alpha.domain.de/core/identity"
      console:
        existingSecret:  
          name: identity-secret-for-components
        existingSecretKey: console-secret
        redirectUrl: "https://camunda-alpha.domain.de/console"
      webModeler:
        redirectUrl: "https://camunda-alpha.domain.de/webmodeler"
      connectors:
        existingSecret: 
          name: identity-secret-for-components
        existingSecretKey: connectors-secret
      core:
        existingSecret: 
          name: identity-secret-for-components
        existingSecretKey: core-secret
        redirectUrl: "https://camunda-alpha.domain.de/core"
      optimize:
        audience: optimize-api
        existingSecret: 
          name: identity-secret-for-components
        existingSecretKey: optimize-secret
        redirectUrl: "https://camunda-alpha.domain.de/optimize"
identity:
  enabled: false
  resources:
    requests:
      cpu: 50m
      memory: 300Mi
    limits:
      cpu: 2000m
      memory: 2Gi
  persistence:
    enabled: true
    size: "5Gi"
identityPostgresql:
  auth:
    existingSecret: "camunda-credentials"
    secretKeys:
      adminPasswordKey: "postgres-admin-password"
      userPasswordKey: "postgres-user-password"
identityKeycloak:
  enabled: false
  contextPath: "/auth"
  resources:
    requests:
      cpu: 50m
      memory: 500Mi
    limits:
      cpu: 2000m
      memory: 2Gi
  postgresql:
    auth:
      existingSecret: camunda-credentials
      secretKeys:
        adminPasswordKey: "identity-keycloak-postgres-admin-password"
        userPasswordKey: "identity-keycloak-postgres-user-password"
connectors:
  logging:
    level:
      io.camunda.connector: DEBUG
  resources:
    requests:
      cpu: 0.01
      memory: 500Mi
    limits:
      cpu: 1
      memory: 1Gi
  envFrom:
    - secretRef:
        name: camunda-connectors-secrets
core:
  debug: true
  clusterSize: "3"
  partitionCount: "6"
  replicationFactor: "3"
  ingress:
    grpc:
      enabled: true
      annotations:
        nginx.ingress.kubernetes.io/enable-global-auth: 'false'
      host: "camunda-alpha-grpc.domain.de"
  contextPath: "/core"
  resources:
    requests:
      cpu: 10m
      memory: 1500Mi
    limits:
      cpu: 2000m
      memory: 3000Mi
  persistenceType: disk
  pvcSize: "10Gi"
optimize:
  enabled: true
  logLevel: trace
  migration:
    enabled: false
    env: []
    resources:
      requests:
        cpu: 50m
        memory: 1Gi
      limits:
        cpu: 2000m
        memory: 2Gi
  sidecars: []
  contextPath: "/optimize"
  partitionCount: "6"
  env: []
  resources:
    requests:
      cpu: 50m
      memory: 500Mi
    limits:
      cpu: 2000m
      memory: 2Gi
  persistence:
    enabled: false
    size: "5Gi"
elasticsearch:
  master:
    replicaCount: 1
    podAntiAffinityPreset: soft
    persistence:
      size: 10Gi
    resources:
      requests:
        cpu: 0.05
        memory: 2Gi
      limits:
        cpu: 2
        memory: 2Gi
  sysctlImage:
    enabled: false
prometheusServiceMonitor:
  enabled: true

@micudaj - the only thing that stood out to me in your values.yaml is that core: should be orchestration: I believe? (see here and here)

What do you mean “create all the clients myself”? Do you mean clients within Identity, to access Camunda?

Interesting: With having core instead of orchestration I can still login to operate, tasklist and identity using a client “core” in keycloak.

I meant that when I start the cluster this way, having keycloak already running, it does not setup the cmaunda-platform realm inside my keycloak anymore as with the “old” separate identity. Should it still do this in this new identity setup?

@micudaj - possible there’s an alias in the charts between core and orchestration - but I do know that orchestration will be the naming convention going forward.

As far as I know, going back to at least 8.5, you had to manually configure the realm when using an external Keycloak instance.

That’s what I thought, so I created them. But then I g et this redirection loop with Optimize. When I compare it with 8.7 (where it works), I see that the callback request (to optimize) does not set a cookie for the user in 8.8, which matches to the log entry in optimize.

2025-08-27 08:06:43.983 DEBUG 8 --- [nio-8092-exec-9] c.o.r.s.c.CCSMAuthenticationCookieFilter : Authenticating null

2025-08-27 08:06:43.983 DEBUG 8 --- [nio-8092-exec-9] c.o.r.s.c.CCSMAuthenticationCookieFilter : No pre-authenticated principal found in request

Is there any way we can make this work, as I try to prepare this setup for a customer and currently optimize is the only think not working.

Nevermind. Just got it working! The optimize-api client was missing and the permissions had to be populated to user by a mapper. now it works.

But using orchestration instead of core did not work so I stick with core for now.

@micudaj - I’m glad you found the solution! I also chatted with our engineers about core vs orchestration: in 8.8-alpha7 (and previous), it is named core, but in 8.8-alpha8 forward it will be orchestration. The team is taking advantage of this still being in an alpha phase and there won’t be backward compatibility between core and orchestration (in other words, there isn’t an “alias” between them, the configs will need to be renamed).

@nathan.loding thank you for the info! I will then change it with version 8.8-alpha8