# How to access discourse username from an iframe?

**URL:** https://meta.discourse.org/t/how-to-access-discourse-username-from-an-iframe/170036
**Category:** Development
**Created:** [November 13, 2020, 12:22pm UTC](https://meta.discourse.org/t/how-to-access-discourse-username-from-an-iframe/170036 "2020-11-13T12:22:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ramith\_Hettiarachchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ramith_hettiarachchi/32/174611_2.png) [@Ramith\_Hettiarachchi](https://meta.discourse.org/u/Ramith_Hettiarachchi)
#### Post date: [November 13, 2020, 12:22pm UTC](https://meta.discourse.org/t/how-to-access-discourse-username-from-an-iframe/170036/1 "2020-11-13T12:22:02Z")

</div>

Is it possible to access the _ **Discourse.User** _ variable from an iframe which has the following code?

> const loggedIn = parent.Discourse.User.current();  
> var quiz\_taker = loggedIn.username;

I set _ **DISCOURSE\_ENABLE\_CORS** _ to true, however it is not working. (added the domain in settings as well) =\> then rebuilt the app
