当前位置:网站首页>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
边栏推荐
- Ott marketing is booming. How should businesses invest?
- vim使用命令
- ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
- 【Redis实现秒杀业务④】一人一单,不可重复购买
- Usage of assert
- Human body transformation vs digital Avatar
- Modstart: embrace new technologies and take the lead in supporting laravel 9.0
- C#和C 的CAN通信实验
- 【Redis实现秒杀业务②】超卖问题的解决方案
- The picture of wechat official account can not be displayed normally
猜你喜欢

Decoupling pages and components using lifecycle

Technology sharing | wvp+zlmediakit realizes streaming playback of camera gb28181
Design and practice of vivo server monitoring architecture
Outer screen and widescreen wasted? Harmonyos folding screen design specification teaches you to use it

Easy to wear - drop down radio

Using tcp/udp tools to debug the yeelight ribbon

How to delete the entire row with duplicate items in a column of WPS table

VNC viewer remote connection raspberry pie without display

Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup

2019 summary and 2020 outlook
随机推荐
实现mnist手写数字识别
断言(assert)的用法
What is the difference between one way and two way ANOVA analysis, and how to use SPSS or prism for statistical analysis
[Solved] Public key for mysql-community-xxx. rpm is not installed
Scrollview height cannot fill full screen
[issue 25] face to face experience of golang Engineer in the rightmost social recruitment
Why are life science enterprises on the cloud in succession?
2019 summary and 2020 outlook
Reservoir dam safety monitoring
Fuxin Kunpeng joins in, and dragon lizard community welcomes a new partner in format document technical service
Use of JMeter easynmon
December 6, 2019 what happens after the browser enters a URL
UE4 WebBrowser chart cannot display problems
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
I suddenly find that the request dependent package in NPM has been discarded. What should I do?
Solution to network access packet loss of Tencent cloud international ECS
Hyperledger Fabric 2. X dynamic update smart contract
C program design topic 18-19 final exam exercise solutions (Part 2)
Garbage collection of C closure
【排行榜】Carla leaderboard 排行榜 运行与参与手把手教学