当前位置:网站首页>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
边栏推荐
- Signal integrity (SI) power integrity (PI) learning notes (I) introduction to signal integrity analysis
- 【Redis实现秒杀业务②】超卖问题的解决方案
- MySQL log management
- 传输层 以字节为单位的滑动窗口技术
- Design and practice of vivo server monitoring architecture
- MySQL semi sync replication
- Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
- Usage of ViewModel and livedata in jetpack
- 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
- Infotnews | is the development of domestic NFT limited to digital collections?
猜你喜欢

Applet opening traffic master

Tiktok wallpaper applet, starlight wallpaper applet version 2.0, upgraded version
Modstart: embrace new technologies and take the lead in supporting laravel 9.0

Use of navigation and navigationui

Interesting checkbox counters

In the process of enterprise development, I found that a colleague used the select * from where condition for update

Ott marketing is booming. How should businesses invest?

Network request -volley

Time unified system

Xcode预览(Preview)显示List视图内容的一个Bug及解决
随机推荐
腾讯云国际云服务器网络访问丢包问题解决办法
A small program written this week
无需显示屏的VNC Viewer远程连接树莓派
Helm chart warehouse operation
Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform
Usage of ViewModel and livedata in jetpack
Easy to wear - drop down radio
【Redis实现秒杀业务③】超卖问题之乐观锁具体实现
Encryption and encoding resolution
MySQL semi sync replication
Domain Driven Design and coding
How to use promise Race() and promise any() ?
Helm chart仓库操作
Use and click of multitypeadapter in recycleview
I suddenly find that the request dependent package in NPM has been discarded. What should I do?
2021-02-15
Qiniu cloud uploads video to get the first frame of video
Transition from digitalization to intelligent manufacturing
Common redis commands in Linux system
Svg line animation background JS effect