Token based authentication(oauth2) using RestHighLevelClient

I have ES 7.0.0 with x-pack and an application using java RestHighLevelClient to connect to it. I am looking for way to setup token based authentication(oauth2) with this client but not able to find any API to set the token in the request after getting it. Can you please give an example (sample code) on how this can be achieved using RestHighLevelClient API.

Hi there,

You can use RequestOptions to set any headers in the request (see here for an example that actually sets the Authorization header with Bearer <token_value> which is exactly what you want )

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