[英]How can i after registration get jwt tokens (djangorestframework)
from django.conf.urls.static import static
from django.contrib import admin from django.urls import path, include
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
from InternetShop import settings from InternetShopApp.views import *
urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/products/', ProductsAPIList.as_view()),
path('api/v1/products/<int:pk>/', ProductsAPIUpdate.as_view()),
path('api/v1/productsremove/<int:pk>/', ProductsAPIRemove.as_view()),
path('api/v1/auth/', include('djoser.urls')),
path('api/v1/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/v1/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('api/v1/token/verify/', TokenVerifyView.as_view(), name='token_verify'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
I need when user successfully register on api/v1/auth/ get jwt tokens in json answer当用户在 api/v1/auth 上成功注册/在 json 中获得 jwt 令牌时,我需要答案
you should enter to this 'api/v1/token/' url and you put that it has asked requirements.你应该输入这个'api/v1/token/' url 并且你说它有要求。 After it gives you two tokens.
在它给你两个令牌之后。 First of them access token so you can login with this token.
首先他们访问令牌,因此您可以使用此令牌登录。 and second of them refresh token, with it you can refresh when your access token's time is finished.
其中第二个刷新令牌,您可以在访问令牌的时间结束时刷新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.