How to authorize django-rest-knox login path without 401 error?

后端 未结 3 820
予麋鹿
予麋鹿 2021-01-21 20:39

I\'m trying to put an authentication api on my django app so I can start using a Vue+Node frontend. I\'ve read over the knox documentation, but I don\'t seem to see anything su

3条回答
  •  清歌不尽
    2021-01-21 21:02

    I ended up getting it work by dropping knox and just using basic auth. I did make other changes like using rest_framework.authentication.TokenAuthentication and rest_framework.permissions.IsAuthenticated in my REST_FRAMEWORK setting and including permission_classes = (AllowAny, ) in my registration and login APIViews. Pretty basic stuff, but I think this should work for what I need. I don't know what I was doing wrong with knox but it seems more trouble that it is worth.

提交回复
热议问题