Error: called with an invalid endpoint: security.getToken

I am creating a Kibana Plugin using the kibana plugin generator, and I have a route defined that is using the elasticsearch dataClient to get a token:

context.core.elasticsearch.dataClient.callAsCurrentUser('security.getToken', {"grant_type":"client_credentials"})

However, I get an error:

Error: called with an invalid endpoint: security.getToken

But I know that this should be a valid endpoint because it is listed here as an API.

Why is this error being thrown? Is there another way to get the token?

Hi which version of Kibana are you working with? If you are not working off the master branch but using a version branch instead, the ES client might not be the same version as the documentation that you found and it might not be new enough to support X-Pack APIs.

If that is the case, you can try using transport.request:

Hi! I am using version 7.6.2. I will go ahead and try the transport.request!

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