简体   繁体   English

无需用户名/密码的Python Django DRF API一次性会话/令牌/通过身份验证

[英]Python Django DRF API one time session/token/pass authentication without a username/password

I have a Django and django rest framework project where I want a mobile to be able to request a token and then use that token for x minutes before they're disconnected. 我有一个Django和django rest框架项目,我希望移动设备能够请求令牌,然后在断开连接前先使用该令牌x分钟。 I do not want to create a user for each mobile device, I just want a one time password. 我不想为每个移动设备创建一个用户,我只想要一个一次性密码。

I tried using the auth system built into drf, however it required a user. 我尝试使用内置在drf中的身份验证系统,但是它需要一个用户。

So I was thinking about just using the onetimepass package to generate a one time token. 因此,我正在考虑仅使用onetimepass软件包来生成一次性令牌。

You can create a view that generates a time-based OTP and then use it in a custom auth module to authenticate against a single user. 您可以创建一个生成基于时间的OTP的视图,然后在自定义身份验证模块中使用它来针对单个用户进行身份验证。 You can also use JWT with an expiry time to authenticate against a single user. 您还可以将JWT与到期时间一起使用,以针对单个用户进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用用户名/密码登录令牌端点:drf 令牌身份验证和自定义用户 model、Django - Cannot log in to token endpoint with username/password: drf token auth and custom user model, Django Selenium + Python-没有URL用户名和密码参数的“处理身份验证”对话框 - Selenium + Python - Handling Authentication Dialog without URL username and password params 带有自定义中间件的django自定义身份验证后端(用户名,密码和令牌不使用身份验证) - django custom authentication backend with custom middleware (both username,password and token absed auth) Python / Django数据库用户名和密码? - Python/Django database username and password? 在Django身份验证期间单独验证用户名和密码 - Separately validating username and password during Django authentication Django DRF-如何使用令牌身份验证进行CSRF验证 - Django DRF - How to do CSRF validation with token authentication Django,DRF令牌认证不起作用,获取匿名用户 - Django, DRF Token authentication doesn't work, get Anonymous User 从密码和用户名获取tweepy身份验证 - python - Getting tweepy authentication from password and username Python Windows 身份验证用户名和密码不起作用 - Python Windows Authentication username and password is not working Django,Angular和DRF:Django后端与API的身份验证 - Django, Angular, & DRF: Authentication to Django backend vs. API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM