TokenAuthentication provided by the Django REST card is designed to be used as a very simple TokenAuthentication authentication. I mean, what do you get
If you are looking for something more advanced, you usually have to look for another token verification method. It may be as simple as subclassing the standard TokenAuthentication classes and views (as indicated), but the Token model is not easily replaced. This means that changing the user field to ForeignKey , allowing you to have multiple tokens for the user, is not easy to implement.
Fortunately, the Django REST framework supports other authentication methods , such as OAuth and JSON Web Tokens, both of which support multiple tokens for users, you can find a comparison of the usual authentication classes in this stack overflow answer .
source share