Unauthenticated Requests not hitting Views #8321
-
Hello! I'm relatively new to using DRM so forgive any technical miscues here :). I had a question around the documentation stating:
So I have a view function that's defined as follows: @api_view(['GET'])
@authentication_classes([TokenAuthentication])
@permission_classes([])
def refresh_spotify_token(request):
pdb.set_trace() Now when I make a request to the above route with an invalid token, shouldn't the code still get to that Unauthorized: /api/v1/users/refresh_spotify_token/
WARNING:django.request:Unauthorized: /api/v1/users/refresh_spotify_token/
[05/Jan/2022 00:31:10] "GET /api/v1/users/refresh_spotify_token/ HTTP/1.1" 401 27 Unless I'm understanding incorrectly, this seems like unexpected behavior since we did not define any Permission Classes. Any help on this matter would be much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
For your view (refresh_spotify_token) to process the request, the user has to be authenticated since you have specified the authentication_classes. A user with an invalid token is not authenticated. |
Beta Was this translation helpful? Give feedback.
For your view (refresh_spotify_token) to process the request, the user has to be authenticated since you have specified the authentication_classes. A user with an invalid token is not authenticated.