# Added route wants me to authenticate?

**URL:** https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836
**Category:** Development
**Created:** [2016年十二月6日 04:39 UTC](https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836 "2016-12-06T04:39:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aedensixty](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@aedensixty](https://meta.discourse.org/u/aedensixty)
#### Post date: [2016年十二月6日 04:39 UTC](https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836/1 "2016-12-06T04:39:12Z")

</div>

I added a route through a plugin in my plugin.rb

post “/generate” =\> “discoursegen#generate”

which is running fine however when I do an ajax call on it the route wants me to use an api key? How can I set the route to be open access without auth?

Thanks,  
Aedan.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [2016年十二月6日 04:55 UTC](https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836/2 "2016-12-06T04:55:48Z")

</div>

`skip_before_filter :ensure_logged_in` in the controller should do it, assuming you want all endpoints of that controller to be unauth’d.

---

<div class="post-metadata">

### Author: ![aedensixty](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@aedensixty](https://meta.discourse.org/u/aedensixty)
#### Post date: [2016年十二月6日 22:45 UTC](https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836/3 "2016-12-06T22:45:59Z")

</div>

That sorted it out. Cheers.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2016年十二月7日 09:01 UTC](https://meta.discourse.org/t/added-route-wants-me-to-authenticate/53836/4 "2016-12-07T09:01:49Z")

</div>


