Sporadic unable to authenticate user OIDC errors

Hey there,

I've been working on setting up a elastic cloud hosted deployment (currently running v7.8.0) with OIDC pointed at Okta. I've run into this error sporadically with various users:

"[security_exception] unable to authenticate user [<OIDC Token>] for action [cluster:admin/xpack/security/oidc/authenticate], with { header={ WWW-Authenticate={ 0=\"Bearer realm=\\\"security\\\"\" & 1=\"ApiKey\" & 2=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } } }"

Following along with OpenID error after authenticating against AWS Cognito I have OIDC trace enabled. I find that if I end up not getting the error I see trace logs showing my token and user info responses and am able to log in and everyone is happy. When I do get the error I do not get any trace logs.

Am a bit at a loss for next steps to debug here. Any pointers would be awesome.

This is the relevant es.yaml segment:

  order: 2
  rp.client_id: "okta client id"
  rp.response_type: code
  rp.redirect_uri: "https://kibana-cloud-domain/api/security/v1/oidc"
  rp.requested_scopes: [openid, email, profile, groups]
  op.issuer: "https://our-domain-here.okta.com"
  op.authorization_endpoint: "https://our-domain-here.okta.com/oauth2/v1/authorize"
  op.token_endpoint: "https://our-domain-here.okta.com/oauth2/v1/token"
  op.jwkset_path: "https://our-domain-here.okta.com/oauth2/v1/keys"
  op.userinfo_endpoint: "https://our-domain-here.okta.com/oauth2/v1/userinfo"
  op.endsession_endpoint: "https://our-domain-here.okta.com/oauth2/v1/logout"
  rp.post_logout_redirect_uri: "https://kibana-cloud-domain/logged_out"
  claims.principal: sub
  claims.name: name
  claims.mail: email
  claims.groups: groups

Here's my kibana block:

    order: 1
    realm: okta
    description: "Log in with Okta"
    hint: "This is probably what you want!"
    icon: "image url here"
    order: 2
    hint: "This is for super admins"

PS. I also sometimes get what looks like a javascript error on the login screen, clicking the option a second time a few seconds later usually lets the request go through. Not sure if it's related.

If you can enable debug logging for kibana and also capture a HAR from your browser when the error happens, we will be more than happy to take a look and see what the issue might be.

PS. I also sometimes get what looks like a javascript error on the login screen,

You mean in Kibana? Can you share the exact error ?

For the JS error: yes, in kibana. Reproducing it now in a private window, I realized just now that it is also trying to report an unauthorized response. Here's what it reports...

Header of the dialog: Could not perform login.
Error field: Unauthorized

Stack trace


I clicked the login button again and it brought me to the okta login prompt.

As for debug logs, any particular category or just across the board for kibana? Will try to reproduce (it would be so much eaiser if it happened consistently :smiley: ) and capture a HAR.

While trying to generate the HAR I hit the same sort of pop up on the main page saying an error occurred, in the respond on the network tab it had

message: "[security_exception] Cannot find OpenID Connect realm with name [okta]"

Is it possible that some of the instances are out of sync somehow?

I may have found a solution. The problem is likely me not understanding that all the different types of ES instances have individual elasticsearch.yaml entry fields in the deployment UI, and even if it says no significant changes when copy-pasting config between them, they are using independent config or something :slight_smile:. Can you tell this is my first time using ES as administrator?

Thanks for the feedback Eugene. We will try to make this more clear in our documentation!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.