How to get response header with cookie from POST request to Kibana REST API /internal/security/login

My goal is to skip login page in Kibana.
With an HTTP request, I would to login in Kibana using the REST API /internal/security/login.
The request is come from my Angular application and to bypass CORS and multi-origin, I edited the http_tools.js adding this line
cors: { additionalHeaders: ['kbn-version','kbn-xsrf','cookie'], origin: ['*'], credentials: true },
instead of
cors: config.cors,

This is the code of the Angular request:

        fetch(environment.URL_login, {
          method: 'POST', body: body,
          credentials: 'include',  headers: {'Content-Type': 'application/json',
          'kbn-version': '7.6.2'},
        }).then(res => {
          console.log(res);
          window.open(environment.URL, "_blank");

The post call returns me status 204 and a Response containing empty headers.
image
If I click on the Network tab of the Inspector Chrome, I see the cookie created in Cookies section.


How can I get the cookie, that is dynamically created by kibana, within the response that I obtain from the http post?

1 Like

I have the similar problem...

1 Like

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