According to this Documentation.如果 您想从刷新令牌获取新的访问令牌。您需要像这样使用请求方法POST:
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"refresh":"somerefreshtokenhere"}' \
http://localhost:8000/api/token/refresh/
反过来,我在django中使用此代码在每次访问令牌过期时刷新令牌:
requests.post(url="somekindofurl/refresh-view"
,headers={"Content-Type": "application/json"},
data={"refresh": variable.refresh_token})
但是,, 这将返回状态为500 internal server error的完整HTML页面。然而,每当我尝试使用邮递员时,它都成功了
如您所见,它按预期返回访问令牌。请注意,我使用的链接和使用的刷新令牌是相同的。我不知道是什么原因导致它返回500状态错误
目前没有回答
相关问题 更多 >
编程相关推荐