Diable basic auth on some pages

28 views
Skip to first unread message

Cherie Pun

unread,
Jun 30, 2015, 10:43:04 AM6/30/15
to django...@googlegroups.com
Hi,

In the dev version of the website, we are using basic auth to limit access. However, we are currently developing an api for the website and I would like to use the api without going through the basic auth. Is it possible to disable basic auth for all the api urls?

Cheers,
Cherie

Alex Heyden

unread,
Jun 30, 2015, 1:12:30 PM6/30/15
to django...@googlegroups.com
Cherie,

By default, there are no authentication controls in Django. Barring some custom middleware, authentication checks are performed within the views themselves or through something like the @login_required or @user_passes_test decorators. Are you certain that authentication is what's blocking your requests?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0d9a681e-74c4-4b74-9648-e0e6c74beeb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cherie Pun

unread,
Jul 1, 2015, 3:51:53 AM7/1/15
to django...@googlegroups.com
Hi,

We are using 'deploy.middleware.basicauth.BasicAuthMiddleware' right now. If I remove that line, I will be able to access the api page. However if it's included, when I access the api page, even after I have typed in the username and password, the api page will show that I am not authenticated to view the page. I am using django_rest_framework by the way, maybe it's some sort of restriction on their side?

Cheers,
Cherie

monoBOT

unread,
Jul 1, 2015, 5:15:57 AM7/1/15
to django...@googlegroups.com

2015-07-01 8:51 GMT+01:00 Cherie Pun <cherie...@gmail.com>:

We are using 'deploy.middleware.basicauth.BasicAuthMiddleware' right now. If I remove that line, I will be able to access the api page. However if it's included, when I access the api page, even after I have typed in the username and password, the api page will show that I am not authenticated to view the page. I am using django_rest_framework by the way, maybe it's some sort of restriction on their side?

​Go check the settings.py to see if you have a permission setting for the whole application.



--
monoBOT
Visite mi sitio(Visit my site): monobotsoft.es/blog/

Cherie Pun

unread,
Jul 1, 2015, 6:03:49 AM7/1/15
to django...@googlegroups.com
Yes it is, would it be possible to disable it for a particular page?

Cheers,
Cherie

monoBOT

unread,
Jul 1, 2015, 8:47:26 AM7/1/15
to django...@googlegroups.com
No, if that permission is applied to the whole application.

But you can aply the permission per view ... just delete that configuration in the settings file and manually apply on the views you want to.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.

Cherie Pun

unread,
Jul 1, 2015, 8:55:45 AM7/1/15
to django...@googlegroups.com
I see. Thanks for the replies, really appreciate your help :)

Cheers,
Cherie
Reply all
Reply to author
Forward
0 new messages