You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having problems setting the default rest framework authentication class to knox.auth.TokenAuthentication. It seems that in the views I have to explicitly set authentication_classes = (TokenAuthentication,):
settings.y
REST_FRAMEWORK= {
# This is not having an effect at all."DEFAULT_AUTHENTICATION_CLASSES": ("knox.auth.TokenAuthentication",)
}
views.py
fromknox.authimportTokenAuthenticationclassUserProfileView(generics.RetrieveUpdateAPIView):
serializer_class=UserProfileSerializerauthentication_classes= (TokenAuthentication,) # It won't work without this linepermission_classes= (permissions.IsAuthenticated,)
defget_object(self):
returnself.request.user
And if I comment authentication_classes = (TokenAuthentication,) I get:
{
"detail": "Authentication credentials were not provided."
}
I may be missing something, but I can't figure it out. Thank you!
The text was updated successfully, but these errors were encountered:
I am having problems setting the default rest framework authentication class to
knox.auth.TokenAuthentication
. It seems that in the views I have to explicitly setauthentication_classes = (TokenAuthentication,)
:settings.y
views.py
And if I comment
authentication_classes = (TokenAuthentication,)
I get:I may be missing something, but I can't figure it out. Thank you!
The text was updated successfully, but these errors were encountered: