# KIbana : Bypass Autentication for ifames to share in dashboard

**URL:** https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991
**Category:** Kibana
**Created:** [November 23, 2018, 10:52am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991 "2018-11-23T10:52:59Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [November 23, 2018, 10:52am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/1 "2018-11-23T10:52:59Z")

</div>

I am using Kibana v6.4.3. I want to share the visualizations created in Kibana as iframes but I don' t want the user to authenteciate to see the dashboards. I read that hitting the POST API - **/api/security/v1/login** , we get a session\_id (sid) which can authenticate the user. I am able to get the session\_id, but when I pass the same in session storage in my browser, Kibana asks for login. Username and password as passed in request body. Please let me know what is the issue ?

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [November 23, 2018, 2:31pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/2 "2018-11-23T14:31:54Z")

</div>

Hi,

Can you go through this thread and see if it helps? We have had a few discuss posts about it.

> [@Auto-authenticate Kibana 5.3 dashboard embedded in iframe](https://discuss.elastic.co/t/auto-authenticate-kibana-5-3-dashboard-embedded-in-iframe/85059):
>
> Auto-authenticate Kibana 5.3 dashboard embedded in iframe... For security we installed X pack.. Anyone help should be appreciated.

If it doesn't work - let me know.

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [November 24, 2018, 12:15pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/3 "2018-11-24T12:15:15Z")

</div>

Hi @bhavyarm,

I have already gone through these discussions. I am able to get Kibana server to respond with the cookie header, but when I set the same in my browsers session storage manually and try running my iframes code, Kibana's login screen is shown.

Is there any issue in my work around ?

Thanks,  
Rishabh

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [November 27, 2018, 8:58am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/4 "2018-11-27T08:58:57Z")

</div>

Hi @bhavyarm,

What I am trying to do is integrate these Kibana iframes into my web-application. Suppose its hosted on **[https://xyz.com](https://xyz.com)**, and the iframes load an external page of Kibana, **https:/abckibana.com**. How can I set the cookie to the URL from the iframe ,i.e, Kiabnas URL ?

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [November 27, 2018, 4:38pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/5 "2018-11-27T16:38:01Z")

</div>

@azasypkin can we please get some help here?

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [November 28, 2018, 11:23am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/6 "2018-11-28T11:23:16Z")

</div>

Hi @azasypkin @bhavyarm

Please address the issue in this thread.

Can this be a valid approach to login Kibana iframe.

As user enters my web-app URL, he is redirected to Kibana endpoint, were I can make the login API call to get the session cookie. Now after getting and setting the cookie, I can redirect the user back to my web-app URL. This is just a work around which I think might work.

Please share your views or a better solution to get this work.

I have seen so many discussions threads where developers are getting stuck with the same issue. There is no proper elasticsearch documentation to address this.

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [November 28, 2018, 12:52pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/7 "2018-11-28T12:52:30Z")

</div>

Hi @rishabh1,

I think the common way to solve this right now is to use proxy in front of Kibana, see [Auto-authenticating to iframe-embedded Kibana dashboard](https://discuss.elastic.co/t/auto-authenticating-to-iframe-embedded-kibana-dashboard/46091/4). Doesn't that work for you?

Best,  
Oleg

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [November 29, 2018, 6:06am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/8 "2018-11-29T06:06:35Z")

</div>

Hi @azasypkin,

I tried to set proxy in front of Kibana, but in that case it gives me 🙂 `

> {"ok":false,"message":"Unknown cluster."}

I also tried to pass below mentioned proxy header as well :

> proxy\_set\_header X-Found-Cluster \<cluster-id\>;

For cluster-id, I passed the **cloud-id** , provided on elastic-search cloud. I would like to mention that I am using elastic-search and Kibana's cloud deployment environment. How can I make this work ?

Best,  
Rishabh

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [November 29, 2018, 2:25pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/9 "2018-11-29T14:25:24Z")

</div>

> For cluster-id, I passed the **cloud-id** , provided on elastic-search cloud. I would like to mention that I am using elastic-search and Kibana's cloud deployment environment. How can I make this work ?

Hmm, I think cloud-id isn't the same as cluster id, I haven't used Kibana in Cloud much, but I guess `cluster id` is the first part of the Kibana URL, see [Change endpoint URLs | Elastic Cloud Enterprise Reference [3.6] | Elastic](https://www.elastic.co/guide/en/cloud-enterprise/current/ece-administering-endpoints.html).

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [December 2, 2018, 1:12pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/10 "2018-12-02T13:12:18Z")

</div>

Hi @azasypkin,

I passed the cluster-id as per the link, but still I get the same error.

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [December 2, 2018, 2:54pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/11 "2018-12-02T14:54:57Z")

</div>

Hi @rishabh1,

I just setup Kibana in Cloud and accessed it though ngnix with cluster-id "extracted" from Kibana endpoint URL - everything worked as expected for me. Please double check that you haven't accidentally mistyped cluster-id. If your ngnix config is correct , but it still doesn't work there may a different issue, hard to say without any debug info.

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [December 2, 2018, 3:57pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/12 "2018-12-02T15:57:49Z")

</div>

@azasypkin

So my Kibana cloud URL is `https://6786d9147a9848f9a0fe0cf7a71a7945.us-east-1.aws.found.io:9243` , so my cluster id will be `6786d9147a9848f9a0fe0cf7a71a7945`

Also, it would be a great help if you can share your `nginx congif` , maybe there is a issue in reverse proxying Kibana in my web app.

Best,  
Rishabh

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [December 2, 2018, 4:24pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/13 "2018-12-02T16:24:48Z")

</div>

@azasypkin

Below is the nginx config I am using

```
server {
        listen 443 default_server ssl;
        server_name analytics-lms.xxxxx.com;

        ssl_certificate /etc/certs/ssl.com/xxxxx;
        ssl_certificate_key /etc/certs/ssl.com/xxxxx;

        ssl_prefer_server_ciphers On;
        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:xxxxxxxx:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;

        root /var/www/html/xxxxxxxx/xxxxx/;
        index index.html index.htm;

        location /{
                root /var/www/html/xxxxxxxx/xxxxx/;
                index index.html;

                proxy_set_header X-Found-Cluster "6786d9147a9848f9a0fe0cf7a71a7945";
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass https://6786d9147a9848f9a0fe0cf7a71a7945.us-east-1.aws.found.io:9243;
                proxy_set_header Authorization "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        }
```

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [December 2, 2018, 8:58pm UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/14 "2018-12-02T20:58:19Z")

</div>

> So my Kibana cloud URL is `https://6786d9147a9848f9a0fe0cf7a71a7945.us-east-1.aws.found.io:9243` , so my cluster id will be `6786d9147a9848f9a0fe0cf7a71a7945`

Yeah, looks correct.

> Also, it would be a great help if you can share your `nginx congif` , maybe there is a issue in reverse proxying Kibana in my web app.

Here are relevant bits from my test config (I'd don't use TLS in ngnix and it's probably easier to make it work without TLS first):

```auto
http {
    ......

    server {
        listen 80;
        server_name localhost;

        location / {
            proxy_pass https://{some-cluster-id}.europe-west3.gcp.cloud.es.io:9243;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_set_header X-Found-Cluster {some-cluster-id};
            proxy_set_header Authorization "Basic {string generated from `echo -n username:password | base64`}";
            proxy_cache_bypass $http_upgrade;
        }
    }
    ....
}

```

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [December 3, 2018, 2:31am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/15 "2018-12-03T02:31:47Z")

</div>

@azasypkin

Thanks for the help.

Using the above nginx configuration, it redirects me to `https://analytics.com/app/kibana`, which opens KIbanas web application rather than opening my web application and showing charts in iframes?

If we are able to solve this. my web app would work just fine 🙂

Best,  
Rishabh

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [December 4, 2018, 9:21am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/16 "2018-12-04T09:21:13Z")

</div>

> [@rishabh1](#):
>
> Using the above nginx configuration, it redirects me to `https://analytics.com/app/kibana` , which opens KIbanas web application rather than opening my web application and showing charts in iframes?

Well, I'm not sure I understand what you're trying to achieve then, I thought you have your web app that is hosted somewhere, then in your app you create iframes (see screenshot below) that point to the cloud Kibana **through** nginx proxy that automatically authenticates users.

![Screenshot%20from%202018-12-04%2010-19-27](https://us1.discourse-cdn.com/elastic/original/3X/5/4/543093106a5f35207ca8b2c31dd20b3560b6970c.png)

Is that correct? If yes, what doesn't work?

---

<div class="post-metadata">

### Author: ![rishabh1](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rishabh1](https://discuss.elastic.co/u/rishabh1)
#### Post date: [December 4, 2018, 9:54am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/17 "2018-12-04T09:54:51Z")

</div>

@azasypkin

> [@azasypkin](#):
>
> Well, I'm not sure I understand what you're trying to achieve then, I thought you have your web app that is hosted somewhere, then in your app you create iframes (see screenshot below) that point to the cloud Kibana **through** nginx proxy that automatically authenticates users.

That is exactly what I am looking for, but when I hit my web app URL (`https://analytics.com`) it should open my web application and iframes should be `visible in my web-app`, right ?  
But instead of that, it automatically redirects me to the URL (`https://analytics.com/app/kibana`) which shows Kibanas web app's home page not my web-apps.

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [December 4, 2018, 11:39am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/18 "2018-12-04T11:39:57Z")

</div>

> That is exactly what I am looking for, but when I hit my web app URL ( `https://analytics.com` ) it should open my web application and iframes should be `visible in my web-app` , right ?  
> But instead of that, it automatically redirects me to the URL ( `https://analytics.com/app/kibana` )

It sounds like an issue in your nginx config that isn't related to Kibana since you use the same domain and path for both your app and Kibana, your proxy may need to define sub-path (e.g. `kib`) for Kibana and `rewrite` it (effectively remove) before forwarding request to Kibana, e.g. something like this (didn't verify, so please, consult `nginx` docs for that):

```auto
location /kib {
      .....
      proxy_pass https://kiaban-cloud-endpoint-url:5601/;
      rewrite ^/kib/(.*)$ /$1 break;
}

```

---

<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: [January 1, 2019, 11:40am UTC](https://discuss.elastic.co/t/kibana-bypass-autentication-for-ifames-to-share-in-dashboard/157991/19 "2019-01-01T11:40:13Z")

</div>

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