Connect Elastic behind authentication


#1

Hi people.

We’ve been working lately with Elastic, and now the server has been updated by adding to it an authentication layer using OAuth. I saw that some other providers like BigQuery support this type of authentication. How can I do the same with elastic? We need to pass the user token on each request after the user is logged in. Is there a way to do that?


#2

Hi @aquiles_js. If there is an OAuth authentication method in front of the ES server, means that you need to authenticate to have an access token and then use that token in every request sent to the ES server. In the case of the ES provider you just need to include the token in the headers property of the provider, so it will look something like this:

cf.setProviders([{
    name: 'Elasticsearch Server',
    provider: 'elasticsearch',
    url: 'https://es-server-url.com',
    headers: { 'Authorization': authToken }
}])

ChartFactor will include the auth token on every request to the server. Hope it helps