How Can I Disable Authentication in Django REST Framework

authentication, django, django-rest-framework

Solution

You can give empty defaults for the permission and authentication classes in your settings.

REST_FRAMEWORK = {
    # other settings...

    'DEFAULT_AUTHENTICATION_CLASSES': [],
    'DEFAULT_PERMISSION_CLASSES': [],
}

Problem

I'm working on a store site, where every user is going to be anonymous (well, until it's time to pay at least), and I'm trying to use Django REST Framework to serve the product API, but it keeps complaining about: ``` "detail": "Authentication credentials were not provided." ``` I found some settings related to authentication, but I couldn't find anything like `ENABLE_AUTHENTICATION = True`. How do I simply disable authentication, and let any visitor to the site access the API?

Original source

Related problems