--- title: JWT tags: ThingsBoard image: https://i.imgur.com/aDx8RDT.png disque: hackmd --- JWT === :::info JSON Web Token(JWT) ::: >get-jwt-token.sh ```bash= curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"username":"your-tb-account@xxxxx.com", "password":"********"}' 'https://demo.thingsboard.io/api/auth/login' ``` >get-jwt-token.py ```python= import sys import requests import json def getToken(): url = 'https://demo.thingsboard.io/api/auth/login' headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} loginJSON = {'username': 'your-tb-account@xxxxx.com', 'password': '********'} tokenAuthResp = requests.post(url, headers=headers, json=loginJSON).json() token = tokenAuthResp['token'] return token print(getToken()) ``` TB REST API - swagger --- :::warning value: JWT token前一定要記得加"Bearer " ::: ![](https://i.imgur.com/aDx8RDT.png) * Example: telemetry-controller : Telemetry Controller * GET /api/plugins/telemetry/{entityType}/{entityId}/keys/timeseries * entityType: **DEVICE** (uppercase only) * entityId: d0b69750-d596-11eb-9381-************ ![](https://i.imgur.com/pZD0KcO.png) Resource(s) --- * [Facebook ThingsBoard Taiwan Group](https://facebook.com/groups/thingsboard)