I am really stuck in my project right now. I am trying to implement Oauth2 for my app. I found out about django-oauth2-provider a lot and tried it. The only problem is, it uses the User model at django.contrib.auth. The main users of our site are saved in a custom model called User which does not inherit from or extend the model at django.contrib.auth.
Is there any way to use my custom User model for creating clients and token?
If django-oauth2-provider can't be used for this purpose, can anyone recommend me some oauth2 library with the option to implement oauth2 with my own model.
Sincerely,
Sushant Karki
django-oauth2-provider fetches the user model using
settings.AUTH_USER_MODEL, with a fallback toauth.User. If you extendAbstractUseryour User model will include all the fields ofauth.Userplus any additional fields you specify.Specify the user model to be used like this in
settings.py:If you don't want to base your user on
AbstractUseryou'll also need to write your own user manager, e.g. by extending theBaseUserManagerYou can read more about ways to customize django's user model here.