How to get JWT_TOKEN through /api/auth/login in Thingsboard?

Viewed 763

When I tried to get telemetry time series data through Data Query API, I need JWT_TOKEN. I followed the documentation and applied:

get_token.sh:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"username":"tenant@thingsboard.org", "password":"tenant"}' 'http://THINGSBOARD_URL/api/auth/login'

I need to apply api/auth/login. But I can't find it in my installation of thingsboard (CE) and dem0.thingsboard.io.

Can someone let me know if api/auth/login is supported in CE or PE?

1 Answers

can you please clarify your question. What is the error? Your command should return two tokens, and you should use the first one. This should be included in the header section for your request.

 token = requests.post('http://demo.thingsboard.io/api/auth/login',
                              json=token_json, headers=token_header).json()["token"]

That line should give you the token you need for other operations or request that need to be done.

Related