I have a simple function-based @api_view(['POST'])
with @permission_classes([AllowAny])
and DRF settings in settings.py are:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
}
The documentation says:
The AllowAny permission class will allow unrestricted access, regardless of if the request was authenticated or unauthenticated.
But I'm getting the following response on making a post request:
{
"detail": "Authentication credentials were not provided."
}
What might be the problem? Do I have to modify DEFAULT_AUTHENTICATION_CLASSES
from the settings? I don't want the permissions to be required while making the request on this @api_view
:
@api_view(['POST'])
@permission_classes([AllowAny])
def reset_password_request(email):
try:
#...
accounts/urls.py:
urlpatterns = [
path('user/<str:pk>/', views.getUserById, name='user'),
path('user/password_reset_request/',
views.resetPasswordRequest, name='password_reset_request'),
]