# Sharing Dashboard via iFrame fails to login

**URL:** <https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639>\
**Category:** Kibana\
**Created:** [January 27, 2022, 11:19pm UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639 "2022-01-27T23:19:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsimi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nsimi/32/39013_2.png) [@nsimi](https://discuss.elastic.co/u/nsimi)\
**Post date:** [January 27, 2022, 11:19pm UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/1 "2022-01-27T23:19:31Z")

</div>

Hello All,

I was looking at trying to share access to my Dashboard via the provided iFrame code, and when I place the iFrame into my html page it its my kibana instance but... it fails to let me log in and see my dashboard, is there another step I need to do to get this configuration working? Or can this not work?

Thank you!

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [January 28, 2022, 12:03am UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/2 "2022-01-28T00:03:11Z")

</div>

Have you tried setting up [anonymous access](https://www.elastic.co/guide/en/elasticsearch/reference/current/anonymous-access.html)?

---

<div class="post-metadata">

**Author:** ![nsimi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nsimi/32/39013_2.png) [@nsimi](https://discuss.elastic.co/u/nsimi)\
**Post date:** [January 28, 2022, 1:05am UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/3 "2022-01-28T01:05:44Z")

</div>

Hello @Nathan_Reese

Thank you for your input here, I have a couple of questions:

1. Once I set up the anonymous user, how do use that user? The iFrame still wants me to log in but that user doesn't have a password? Is there some configuration I need beyond that?
2. How can I prevent the anonymous user from being used by someone else to access other dashboards/data beyond what I am hosting in my iFrame? I am assuming there is some way to tie it to the iFrame?

I appreciate the assistance here thank you!

---

<div class="post-metadata">

**Author:** ![nsimi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nsimi/32/39013_2.png) [@nsimi](https://discuss.elastic.co/u/nsimi)\
**Post date:** [January 28, 2022, 2:40am UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/4 "2022-01-28T02:40:29Z")

</div>

Hello @Nathan_Reese

I did find these pages:

- [Embedding a dashboard](https://www.elastic.co/guide/en/kibana/7.12/embedding.html)
- [Kibana Authentication](https://www.elastic.co/guide/en/kibana/current/kibana-authentication.html#embedded-content-authentication)

Both of which seemed helpful, I was attempting to use the

> ?auth\_provider\_hint=anonymous1

technique mixed with configuring kibana.yml for a credential based login of an anonymous user. If I am not mistaken this doesn't require any configuration other than to create the user on the elasticsearch side.

But this had some weird outcomes:

1. First it made it so that it completely eliminated logging in so I had to add a basic auth section in above that in the order and indicate that
2. Once I did that it didn't just default to logging me in as the "anonymous" user and would let me again log in as any user I wanted but, now when I tried to go to my iFrame it would just load over and over again, alternating between the "welcome to elastic/authenticating" and "loading elastic" screens but never make it to my dashboard.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [January 28, 2022, 1:03pm UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/5 "2022-01-28T13:03:35Z")

</div>

Hey @nsimi,

> First it made it so that it completely eliminated logging in so I had to add a basic auth section in above that in the order and indicate that

Yes, if your `kibana.yml` started with no configuration for `xpack.security.authc.providers`, then we default it to use the `basic` auth provider. However, once you configure this with one or more entries, we no longer include the `basic` auth provider by default, so you have to add it in if you still want to use it.

> when I tried to go to my iFrame it would just load over and over again, alternating between the "welcome to elastic/authenticating" and "loading elastic" screens but never make it to my dashboard

This sounds like the browser isn't setting Kibana's session cookie correctly. I have a couple of followup questions for you:

1. Just double checking this, did you configure Kibana to not require same-site cookies? This is done by setting `xpack.security.sameSiteCookies: "None"`, as described in the [`Embedding a dashboard` docs](https://www.elastic.co/guide/en/kibana/7.12/embedding.html#embedding-cookies).
2. What browser are you using? Safari is especially problematic here, but you could have this happen in any private browsing session: [User cannot open Kibana in private browsing with cookies blocked · Issue #41444 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/41444). There's not much that Kibana can do in this scenario, as the browser is explicitly forbidding us from setting these cross-origin cookies. Without these cookies, Kibana simply can't authenticate or authorize you.

If the same-site cookie config doesn't fix your problem, can you post your full `kibana.yml` file, but redact any sensitive information such as URLs, usernames, and passwords?

---

<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:** [February 25, 2022, 1:04pm UTC](https://discuss.elastic.co/t/sharing-dashboard-via-iframe-fails-to-login/295639/6 "2022-02-25T13:04:14Z")

</div>

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