DRF的承载认证。

django-rest-auth-bearer的Python项目详细描述


django rest bearler auth
--

必须安装了“rest_framework”,然后通过pip安装“bearer auth”,并将其添加到“settings.py`

`` python
`` pip安装django rest auth bearer
````
`` python
已安装的应用程序:[
…,
‘rest_framework',
‘bearer auth',
]
````


````



``python
```python
```python
token\u expires\u-token\u expires\u-in=2小时
`````


``````````
``````````python
```````python
````````````````python

>>


/>path('auth/token,auth/token,obtaintoken.obtaintoken.as\/>```

获取令牌

``json
“username”:“username”、
“password123”、
“grant-type”:“password”//必须是password
````
``json
{
“token-type”:“bearker”,
“访问令牌”:“c2fbea30732f113bbf879e51b2e49544d2de210”
“刷新令牌”:“8ab39baa8f29041a891767a9323500073c9ee8e89e944af759”,
“过期时间”:1
}
`````

此外,为了刷新当前令牌,将带有grant-type`refresh-token`的'refresh-token`值发送到同一端点

``json
{
“refresh-token”:“8ab39baa8f29041a891767a9323500073c9ee8e89e944af759”,
“grant-type”:“refresh-token”
}
```

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何使用Array和ArrayList做同样的事情?   用户界面使Java JScrollpane仅垂直滚动   查找字符串中最长的重复子字符串所需的算法Java函数?   java我想在listview中检索firebase数据   java如何使用Jsoup提取链接?   java 安卓。看法使用RTEditor时发生充气异常   maven为什么自动依赖是错误版本?(java.lang.ClassNotFoundException:org.junit.jupiter.api.MethodOrderContext)   使用apachespark进行java开发   java glDrawBuffers是否应该翻转IntBuffer?   java在添加回调之前完成CompletableFuture<T>   用Java构建搜索树   java将web应用程序部署到Heroku   active directory Java LDAP:属性为只读   启动Spring启动应用程序时未考虑java DB端口   使用Mockito的java模拟   C++从运行时运行java的过程。执行出口代码139   javascript使用脚本删除旧SonarQube项目   java代理每节点模型?   java无法在Android上通过Internet从PC服务器接收UDP数据   在bluemix:java上加载p12时发生ibm云错误。木卫一。IOException:数据不足