我正在学习Django生态系统,并试图弄清楚如何在simplejwt库提供的“ hello world”之外实现JWT身份验证(尝试构建realworld.io REST API)。我不明白该怎么办:我应该使用simplejwt库还是pyjwt并创建我的自定义身份验证逻辑。
例如,我希望能够:
POST /users
并使用
{
"email": "test@example.com",
"password": "password",
"username": "username"
}
并获得结果
{
"email": "test@example.com",
"username": "username",
"token": <JWT_TOKEN_HERE>
}
并能够通过发送Bearer <JWT_TOKEN_HERE>
https://github.com/davesque/django-rest-framework-simplejwt,让我创建具有内置功能的2个端点,但是我想为自己定制它。