There have been multiple threads on this topic but most of them seem to circle around the same answers with contradicting official statements.
I want to auto-login users to a Kibana dashboard from a web app. I have enabled x-pack security and tried to get the auth cookie with an ajax request before showing the dashboard but unfortunately, I get the preflight CORS error:
OPTIONS with code 404.
There is an official response in this thread saying that this is not supported, and an unofficial thread here suggesting the same.
Despite this, there are official responses like in this thread here suggesting that it can be done setting the kibana.yml values:
server.cors: true
server.cors.origin: "*"
Adding this removed the 404 problem but the CORS couldn't recognize the headers ('kbn-xsrf') so I used a solution from here and modified http_tools.js with:
cors: { additionalHeaders: ['kbn-xsrf','cookie'], origin: ['*'], credentials: true }
which ended up returning 200 OK for OPTIONS and 204 No Content for POST but did not set the cookie in the browser.
Another thread with an official answer seems to suggest that it can't be done even if you manage to attach the cookie to the browser.
Is such an approach even possible taking into account contradicting answers across the board?
Another suggested approach is to use an NGINX reverse proxy to add authentication, but wouldn't that mean that every request to Kibana would be authorized and unprotected?