# How to use Discourse user session info in iframe?

**URL:** https://meta.discourse.org/t/how-to-use-discourse-user-session-info-in-iframe/216642
**Category:** SSO
**Created:** [January 31, 2022, 10:44pm UTC](https://meta.discourse.org/t/how-to-use-discourse-user-session-info-in-iframe/216642 "2022-01-31T22:44:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![4ong](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/4ong/32/186618_2.png) [@4ong](https://meta.discourse.org/u/4ong)
#### Post date: [January 31, 2022, 10:44pm UTC](https://meta.discourse.org/t/how-to-use-discourse-user-session-info-in-iframe/216642/1 "2022-01-31T22:44:29Z")

</div>

What is the best and safest way to send Discourse user session info (username f.e.) to iframe?  
I have a small app that I use in posts as iframe. I want to control who is accessing it.

Thanks!

---

<div class="post-metadata">

### Author: ![Mark\_Schmucker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_schmucker/32/124810_2.png) [@Mark\_Schmucker](https://meta.discourse.org/u/Mark_Schmucker)
#### Post date: [January 31, 2022, 11:28pm UTC](https://meta.discourse.org/t/how-to-use-discourse-user-session-info-in-iframe/216642/2 "2022-01-31T23:28:05Z")

</div>

Does this help?

> [@Using Discourse variables to personalize embedded Typeform](https://meta.discourse.org/t/using-discourse-variables-to-personalize-embedded-typeform/111329/5):
>
> Here is my (somewhat clumsy) solution, in case it helps someone. I added this code under Admin \> Customize \> Themes \> Edit CSS/HTML \> /head: \<script type="text/discourse-plugin" version="0.8"\> api.decorateCooked($elem =\> { var i, j; var selector = 'https://example.typeform.com'; // seems like this should work but it doesn't: // var typeforms = $elem[0].querySelectorAll('src^=[' + selector + ']'); var ps = $elem[0].querySele…

---

<div class="post-metadata">

### Author: ![4ong](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/4ong/32/186618_2.png) [@4ong](https://meta.discourse.org/u/4ong)
#### Post date: [February 1, 2022, 11:19am UTC](https://meta.discourse.org/t/how-to-use-discourse-user-session-info-in-iframe/216642/3 "2022-02-01T11:19:48Z")

</div>

Thank you @Mark_Schmucker ! Fantastic.  
Sounds exactly how I need it.
