# Cannot Login to grafana when embedded in iframe

**URL:** <https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276>\
**Category:** Configuration\
**Created:** [July 2, 2024, 9:38am UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276 "2024-07-02T09:38:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximbozek2002](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@maximbozek2002](https://community.grafana.com/u/maximbozek2002)\
**Post date:** [July 2, 2024, 9:38am UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/1 "2024-07-02T09:38:04Z")

</div>

Hi,

I want to embed my grafana instance in an iframe and login to grafana via there.  
I have succesfully embedded grafana into my webpage, but when I login succesfully, it just takes me straight back to an empty login page.

Also I don’t want to enable anonymous access because you can then just visite my grafana instance and access all dashbaords without logging in.

Does anybody know a solution?

---

<div class="post-metadata">

**Author:** ![vijha1989](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/vijha1989/32/45147_2.png) [@vijha1989](https://community.grafana.com/u/vijha1989)\
**Post date:** [July 4, 2024, 6:00am UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/2 "2024-07-04T06:00:03Z")

</div>

Can you try this:

### Set to true to enable embedding Grafana dashboards in iframes

allow\_embedding = true

[http]

### Set to true to allow the browser to send and receive cookies from the iframe

cookie\_samesite = true

[auth]

### Enable cookie authentication

login\_cookie\_name = grafana\_session  
login\_maximum\_inactive\_lifetime\_days = 7  
login\_maximum\_lifetime\_days = 30  
disable\_login\_form = false

---

<div class="post-metadata">

**Author:** ![maximbozek2002](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@maximbozek2002](https://community.grafana.com/u/maximbozek2002)\
**Post date:** [July 4, 2024, 6:21am UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/3 "2024-07-04T06:21:42Z")

</div>

Doesn’t work, but we came to a new solution for our use case.

---

<div class="post-metadata">

**Author:** ![joerivoet](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/joerivoet/32/45124_2.png) [@joerivoet](https://community.grafana.com/u/joerivoet)\
**Post date:** [August 12, 2024, 12:36pm UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/4 "2024-08-12T12:36:45Z")

</div>

@vijha1989  
`true` is not a valid value for `cookie_samesite`, see [documentation](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#cookie_samesite).

@maximbozek2002  
Care to share what you did to solve it?

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [August 12, 2024, 1:02pm UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/5 "2024-08-12T13:02:16Z")

</div>

check this out [How to embed Grafana dashboards into web applications | Grafana Labs](https://grafana.com/blog/2023/10/10/how-to-embed-grafana-dashboards-into-web-applications/)

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [October 16, 2024, 1:48am UTC](https://community.grafana.com/t/cannot-login-to-grafana-when-embedded-in-iframe/125276/6 "2024-10-16T01:48:44Z")

</div>


