# Guidance on \`login\_not\_required\` for third-party views

**URL:** <https://forum.djangoproject.com/t/guidance-on-login-not-required-for-third-party-views/43281>\
**Category:** Packages\
**Created:** [October 27, 2025, 8:48pm UTC](https://forum.djangoproject.com/t/guidance-on-login-not-required-for-third-party-views/43281 "2025-10-27T20:48:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![medmunds](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/medmunds/32/22140_2.png) [@medmunds](https://forum.djangoproject.com/u/medmunds)\
**Post date:** [October 27, 2025, 8:48pm UTC](https://forum.djangoproject.com/t/guidance-on-login-not-required-for-third-party-views/43281/1 "2025-10-27T20:48:11Z")

</div>

I maintain a third party library that provides webhook callback views. I got a [bug report](https://github.com/anymail/django-anymail/issues/443) that using Django’s LoginRequiredMiddleware (introduced in 5.1) breaks the webhooks.

Looking for some guidance on how third party packages are expected to handle LoginRequiredMiddleware:

- Yes! Go ahead and apply `login_not_required` to any views that shouldn’t be subject to Django’s authentication (webhooks, alternative login and password reset pages, email unsubscribe links, etc.)
- No! Using `login_not_required` in third party packages could introduce unexpected security issues. Developers wanting to use LoginRequiredMiddleware should carefully think through views where it shouldn’t apply, and then use the decorator only where _they’ve_ determined it’s appropriate. (And maybe Django should mention that in the docs.)
- There’s no one good answer. Because…?

(There was some earlier discussion in [Add a Setting to Exempt URLs in `LoginRequiredMiddleware` - #4 by matthiask](https://forum.djangoproject.com/t/add-a-setting-to-exempt-urls-in-loginrequiredmiddleware/39714/4) . From that, I _think_ the answer is “Yes.” But I’d like to be sure.)

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [October 27, 2025, 9:16pm UTC](https://forum.djangoproject.com/t/guidance-on-login-not-required-for-third-party-views/43281/2 "2025-10-27T21:16:35Z")

</div>

I’d lean towards “Yes!” personally. The cases you gave shouldn’t require a login. I think if there are some views that a user may want to put behind a login, they can rework their urlpatterns to do that.

---

<div class="post-metadata">

**Author:** ![matthiask](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/matthiask/32/115_2.png) [@matthiask](https://forum.djangoproject.com/u/matthiask)\
**Post date:** [October 27, 2025, 9:19pm UTC](https://forum.djangoproject.com/t/guidance-on-login-not-required-for-third-party-views/43281/3 "2025-10-27T21:19:56Z")

</div>

The answer is a definite yes for the webhooks I know. All of them use a way of authenticating requests which isn’t tied to Django’s authentication (and session) system. Some of them only include the bare minimum and expect you to check back with the originating server, others include a cryptographic signature which you’re expected to calculate as well. I don’t know what Brevo does specifically but since you probably shouldn’t put a username/password combination into the Brevo webhook URL (and that would use basic authentication anyway for which Django doesn’t have any support out of the box) you can assume that the webhook URL should be available without Django authentication.
