django-rest-framework-simplejwt

Django drf simple-jwt authentication“detail”: “No active account found with the given credentials”

浪尽此生 提交于 2020-06-14 05:00:19
问题 I am implementing user authentication with django-rest_framework_simple-jwt with custom user, My models.py: class UserManager(BaseUserManager): def create_user(self, email, username, password, alias=None): user = self.model( email = self.normalize_email(email), username = username,) user.set_password(password) user.save() return user def create_superuser(self, email, username, password): self.create_user(email, username, password) user.is_staff() user.is_superuser = True user.save() return

DRF: Customising Exception Messages from the API

故事扮演 提交于 2020-04-10 06:35:32
问题 I'm starting to dive into DRF a little deeper of late, and I was wondering I would like to start customising the error messaging that gets return via the API for incorrect permissions, I'd like to wrap a little extra detail. For example, if authentication credentials were not provided for an endpoint that is permission restricted, the API returns: { "detail": "Authentication credentials were not provided." } Which comes from line 171 from the rest_framework.exceptions : https://github.com

DRF: Customising Exception Messages from the API

≡放荡痞女 提交于 2020-04-10 06:35:09
问题 I'm starting to dive into DRF a little deeper of late, and I was wondering I would like to start customising the error messaging that gets return via the API for incorrect permissions, I'd like to wrap a little extra detail. For example, if authentication credentials were not provided for an endpoint that is permission restricted, the API returns: { "detail": "Authentication credentials were not provided." } Which comes from line 171 from the rest_framework.exceptions : https://github.com