Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在后端接收刷新令牌以将令牌列入黑名单。
当用户传递访问令牌以调用 API 时,我正在获取访问令牌request.header,有没有办法在用户未传入标头时获取刷新令牌。
request.header
您可以在views.py中以这种方式使用RefreshToken:
from rest_framework_simplejwt.tokens import RefreshToken def my_request(request): token = RefreshToken.for_user([INSERT HERE THE USER CLASS]) #You can now use the refresh token return Response(status=status.HTTP_200_OK)