# Cross origin request from plugin

**URL:** <https://meta.discourse.org/t/cross-origin-request-from-plugin/43548>\
**Category:** Development\
**Created:** [May 2, 2016, 7:42am UTC](https://meta.discourse.org/t/cross-origin-request-from-plugin/43548 "2016-05-02T07:42:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Andrew\_Byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_byrne/32/116413_2.png) [@Andrew\_Byrne](https://meta.discourse.org/u/Andrew_Byrne)\
**Post date:** [May 3, 2016, 1:22am UTC](https://meta.discourse.org/t/cross-origin-request-from-plugin/43548/3 "2016-05-03T01:22:05Z")

</div>

Well that was easy…

[https://github.com/abyrnedesign/discourse-json-follow-list/commit/d32ecf780497e64a5e6fc65d09394fdaf706e4bf](https://github.com/abyrnedesign/discourse-json-follow-list/commit/d32ecf780497e64a5e6fc65d09394fdaf706e4bf)

added 2 checks from the application controller.

```
skip_before_filter :check_xhr #allow API requests
before_filter :ensure_logged_in #or just check the users logged in

```

**skip\_before\_filter :check\_xhr** ← does as it says.  
looks for a XHR request and requires an API key skips and other checks if found.

**before\_filter :ensure\_logged\_in** ← another brilliant function name.  
Looks for user login

Close it up @codinghorror !

---

_[View the full topic](https://meta.discourse.org/t/cross-origin-request-from-plugin/43548)._
