Replies: 3 comments
-
Hi @bale836 Are you able to make this work on simpler views, in settings similar to those listed in the docs? E.g. set up a simple manual view, and see if you can have permissions work. It's possible there's a more general configuration issue on your end than an issue specifically tied to |
Beta Was this translation helpful? Give feedback.
-
Hi @bale836, If you haven't yet resolved your issue, I was having similar issues trying to use HasAPIKey along with DjangoModelPermissions, getting the 403 when using the API key. I was able to get things to work by applying the following permissions_classes decorator to my view set. Notice the '|' to 'or' the two permission classes. In your example, you have the classes separated by commas which didn't work for me:
Versions that I am using:
Hope this helps... |
Beta Was this translation helpful? Give feedback.
-
@kensthilaire Please help me out as well I have same versions as you but i can not use HasApiKey with simplest view its always giving me this error My view has permission class permission_classes = [HasAPIKey] Versions |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I have a try to use in ModleViewSet, but it cannot work:
class myViewSet(viewsets.ModelViewSet):
authentication_classes = (CustomAuthentication, SessionAuthentication, BasicAuthentication)
permission_classes = (HasAPIKey, IsAuthenticated, DjangoModelPermissions,)
i set the request.user to a Anonymous object in CustomAuthentication class
and i try to request the resource with GET
i get 403 with "You do not have permission to perform this action."
Describe the solution you'd like
please help to me, this project cannot support ModelViewSet?
If it is, has plan to support it?
Describe alternatives you've considered
Additional context
djangorestframework-api-key: 2.1.0
djangorestframework: 3.12.4
Beta Was this translation helpful? Give feedback.
All reactions