# Authentication with Kibana in HTML Iframe

**URL:** <https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476>\
**Category:** Kibana\
**Created:** [June 19, 2019, 1:31pm UTC](https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476 "2019-06-19T13:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nsaneone](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@Nsaneone](https://discuss.elastic.co/u/Nsaneone)\
**Post date:** [June 19, 2019, 1:31pm UTC](https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476/1 "2019-06-19T13:31:05Z")

</div>

Good Afternoon. Been trying to get Kibana Visualisation to load into an Iframe (using the link auto generated). This works however there is Kibana login prompt that occurs. I wanted to ask if there is anyway I could pass credentials to the Frame, or even before, so that when the frame loads it will auto log in. I have been searching the forum , and found some clues, like below.

I was able to get the Kibana server to respond with a cookie header by POSTing to `/api/security/v1/login` with a JSON request body of

```auto
{
    "password": "<YOURPASSWORD>",
    "username": "<YOURUSERNAME>"
}

```

The above returns a HTML code of 204 (no data I think). But the authentication cookie is still not set as when the page loads, it still asked for authentication. Any assistance would be appreciated.

Thank you

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [June 19, 2019, 6:49pm UTC](https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476/2 "2019-06-19T18:49:00Z")

</div>

Hi!

This is something that is frequently posted on the forums here. A quick search might be helpful here:

[https://discuss.elastic.co/search?q=iframe+authentication](https://discuss.elastic.co/search?q=iframe+authentication)

Specifically these:

> [@Authenticating to iframe-embedded Kibana dashboard](https://discuss.elastic.co/t/authenticating-to-iframe-embedded-kibana-dashboard/71129/7):
>
> Sorry for the delay, @rupaln and sorry for giving incomplete advice. I was able to get the Kibana server to respond with a cookie header by POSTing to /api/security/v1/login with a JSON request body of { "password": "\<YOURPASSWORD\>", "username": "\<YOURUSERNAME\>" } and the appropriate kbn-version: 5.1.1 header.

> [@Auto-authenticating to iframe-embedded Kibana dashboard](https://discuss.elastic.co/t/auto-authenticating-to-iframe-embedded-kibana-dashboard/46091/16):
>
> @tsullivan @Alex_Piggott @Francisca_Lima and others interested. Looks like you should use proxy\_set\_header Host $proxy\_host; instead of proxy\_set\_header Host $host; $proxy\_host takes host value from proxy\_pass directive, while $host will contain your server\_name. And apparently, Kibana from Elastic Cloud requires an original host to determine target cluster ID. Works for me without proxifying any additional X-Found-Cluster headers.

---

<div class="post-metadata">

**Author:** ![Nsaneone](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@Nsaneone](https://discuss.elastic.co/u/Nsaneone)\
**Post date:** [June 25, 2019, 8:59am UTC](https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476/3 "2019-06-25T08:59:27Z")

</div>

Thank you Lukas for your reply. Apologies I should have made my environment a little clear. Currently I am using HTML/Javascript with PHP. I try to send username and password to Kibana, however once I redirect it still presents a log in page. The request is being sent from the server (through PHP).  
Is this because the request is coming from the server - and so authenticates, but then the client requests the page and so still requires authentication?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 23, 2019, 8:59am UTC](https://discuss.elastic.co/t/authentication-with-kibana-in-html-iframe/186476/4 "2019-07-23T08:59:32Z")

</div>

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