当前位置:网站首页>Thingsboard - rest API obtains and refreshes tokens
Thingsboard - rest API obtains and refreshes tokens
2022-06-25 00:40:00 【a10615】
ThingsBoard Of REST API The document uses Swagger, Most interfaces can be viewed and tested through this address ( The interface with a lock icon in the back indicates that authentication is required )
http://{
{YOUR_HOST}}:{
{PORT}}/swagger-ui.html
One 、 Log in to get token
Login interface in login-endpoint In the group
POST /api/auth/login
request
The account number and password are placed in requestBody Request body
{
"username": "[email protected]",
"password": "tenant"
}
Respond to
return token and refreshToken
{
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi...",
"refreshToken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi..."
}
Interface requiring authentication , stay Header Zhongba token close ( Be careful :Bearer There is a space after ):
X-Authorization: Bearer $JWT_TOKEN_VALUE
Two token, All are JWT encryption , Can be decrypted through online tools . Decrypt it ,token Is valid for 2.5h,refreshToken yes 7day.JWT The explanation and decryption tools are shown at the end
Two 、 Refresh token
Refresh token Don't pass Swagger Generated in document
POST /api/auth/token
request
hold refreshToken Put it in the request body (Header No need to carry token):
{
"refreshToken": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi..."
}
Respond to
Will return a new token And the new refreshToken
{
"token": "abchbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi...",
"refreshToken": "efghbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi..."
}
3、 ... and 、 Reference resources
边栏推荐
- How to use promise Race() and promise any() ?
- Single blind box removal, social blind box and friend blind box program source code
- C程序设计专题 15-16年期末考试习题解答(上)
- C WinForm maximizes occlusion of the taskbar and full screen display
- C#和C 的CAN通信实验
- Zed acquisition
- MySQL log management
- Go crawler framework -colly actual combat (II) -- Douban top250 crawling
- Interesting checkbox counters
- Infotnews | is the development of domestic NFT limited to digital collections?
猜你喜欢
JDBC - database connection
Tiktok wallpaper applet source code
A small program written this week
不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...
【Redis实现秒杀业务③】超卖问题之乐观锁具体实现
C# Winform 最大化遮挡任务栏和全屏显示问题
Single blind box removal, social blind box and friend blind box program source code
WordPress add photo album function [advanced custom fields Pro custom fields plug-in series tutorial]
传输层 以字节为单位的滑动窗口技术
Sliding window technology based on byte in transport layer
随机推荐
Virtual machine - network configuration
[leaderboard] Carla leaderboard leaderboard leaderboard operation and participation in hands-on teaching
Design and practice of vivo server monitoring architecture
傳輸層 以字節為單比特的滑動窗口技術
The new employee of the Department after 00 is really a champion. He has worked for less than two years. The starting salary of 18K is close to me when he changes to our company
软件测试与游戏测试文章合集录
Overview of medium and low speed aerospace electronic bus
Basic summary of MySQL database knowledge
C#和C 的CAN通信实验
redis + lua实现分布式接口限流实现方案
Use of navigation and navigationui
Practical operation notes - notebook plus memory and ash cleaning
[interview question] what is a transaction? What are dirty reads, unrepeatable reads, phantom reads, and how to deal with several transaction isolation levels of MySQL
[interview question] the difference between instancof and getclass()
融合模型权限管理设计方案
在企业级开发过程中我发现有位同事用select * from where 条件 for update
A small program written this week
2021-04-18
【微服务|Sentinel】簇点链路|微服务集群环境搭建
Kubernetes 架构核心组件工作原理解析