django-rest-framework-simplejwt

DRF SimpleJWT remove password and add date field

北慕城南 提交于 2021-02-17 07:10:39
问题 I created a custom user model extending from AbstractBaseUser where the only data I'm getting from the user is a userID, user (the username field) and date (required and in the format dd-mm-yyyy ) and the creation of the user works fine as you can see from the DB in the next image Used password = None and last_login = None to refer i didn't want password and last_login tables. Then, created a view where only authenticated users can access. To handle the authentication, used simpleJWT. In urls

DRF SimpleJWT remove password and add date field

会有一股神秘感。 提交于 2021-02-17 07:10:08
问题 I created a custom user model extending from AbstractBaseUser where the only data I'm getting from the user is a userID, user (the username field) and date (required and in the format dd-mm-yyyy ) and the creation of the user works fine as you can see from the DB in the next image Used password = None and last_login = None to refer i didn't want password and last_login tables. Then, created a view where only authenticated users can access. To handle the authentication, used simpleJWT. In urls

DRF SimpleJWT remove password and add date field

强颜欢笑 提交于 2021-02-17 07:10:05
问题 I created a custom user model extending from AbstractBaseUser where the only data I'm getting from the user is a userID, user (the username field) and date (required and in the format dd-mm-yyyy ) and the creation of the user works fine as you can see from the DB in the next image Used password = None and last_login = None to refer i didn't want password and last_login tables. Then, created a view where only authenticated users can access. To handle the authentication, used simpleJWT. In urls

remove authentication and permission for specific url path

断了今生、忘了曾经 提交于 2021-02-06 12:59:48
问题 I'm working with DRF and came across this issue. I have a third-party view which I'm importing in my urls.py file like this : from some_package import some_view urlpatterns = [ path('view/',some_view) ] but the issue I'm facing is since I have enabled default permission classes in my settings.py like this: REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', ), 'DEFAULT_PERMISSION_CLASSES':( 'rest_framework.permissions.IsAuthenticated', )

remove authentication and permission for specific url path

帅比萌擦擦* 提交于 2021-02-06 12:58:25
问题 I'm working with DRF and came across this issue. I have a third-party view which I'm importing in my urls.py file like this : from some_package import some_view urlpatterns = [ path('view/',some_view) ] but the issue I'm facing is since I have enabled default permission classes in my settings.py like this: REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', ), 'DEFAULT_PERMISSION_CLASSES':( 'rest_framework.permissions.IsAuthenticated', )

Adding claims to DRF simple JWT payload

冷暖自知 提交于 2020-12-26 13:50:20
问题 Using djangorestframework_simplejwt library, when POST to a custom view #urls.py path('api/token/', MyTokenObtainPairView.as_view(), name='token_obtain'), #views.py class MyTokenObtainPairView(TokenObtainPairView): serializer_class = MyTokenObtainPairSerializer I'm able to get a the following access token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTkwOTEwNjg0LCJqdGkiOiI3M2MxYmZkOWNmMGY0ZjI3OTY4MGY0ZjhlYjA1NDQ5NyIsInVzZXJfaWQiOjExfQ

Adding claims to DRF simple JWT payload

£可爱£侵袭症+ 提交于 2020-12-26 13:32:06
问题 Using djangorestframework_simplejwt library, when POST to a custom view #urls.py path('api/token/', MyTokenObtainPairView.as_view(), name='token_obtain'), #views.py class MyTokenObtainPairView(TokenObtainPairView): serializer_class = MyTokenObtainPairSerializer I'm able to get a the following access token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTkwOTEwNjg0LCJqdGkiOiI3M2MxYmZkOWNmMGY0ZjI3OTY4MGY0ZjhlYjA1NDQ5NyIsInVzZXJfaWQiOjExfQ

Adding claims to DRF simple JWT payload

旧时模样 提交于 2020-12-26 13:32:01
问题 Using djangorestframework_simplejwt library, when POST to a custom view #urls.py path('api/token/', MyTokenObtainPairView.as_view(), name='token_obtain'), #views.py class MyTokenObtainPairView(TokenObtainPairView): serializer_class = MyTokenObtainPairSerializer I'm able to get a the following access token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTkwOTEwNjg0LCJqdGkiOiI3M2MxYmZkOWNmMGY0ZjI3OTY4MGY0ZjhlYjA1NDQ5NyIsInVzZXJfaWQiOjExfQ

Adding claims to DRF simple JWT payload

自古美人都是妖i 提交于 2020-12-26 13:27:07
问题 Using djangorestframework_simplejwt library, when POST to a custom view #urls.py path('api/token/', MyTokenObtainPairView.as_view(), name='token_obtain'), #views.py class MyTokenObtainPairView(TokenObtainPairView): serializer_class = MyTokenObtainPairSerializer I'm able to get a the following access token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTkwOTEwNjg0LCJqdGkiOiI3M2MxYmZkOWNmMGY0ZjI3OTY4MGY0ZjhlYjA1NDQ5NyIsInVzZXJfaWQiOjExfQ

How to skip or remove password field in simplejwt token authentication in django rest framework?

最后都变了- 提交于 2020-07-09 16:08:09
问题 My requirement is, I don't wanted to enter password in simplejwt token authentication. I have added one extra field in the authentication by inheriting the init() method of TokenObtainPairSerializer as per my requrements. Currently, I am passing None as in password field but still its showing to user (djnago admin portal). What I want is, I don't wanted to show the password field to user while authentication using simplejwt. below is my code, from rest_framework_simplejwt.serializers import