Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] API rest OAuth 2 #1159

Open
emurilloEcourbes opened this issue Aug 10, 2023 · 2 comments
Open

[HELP] API rest OAuth 2 #1159

emurilloEcourbes opened this issue Aug 10, 2023 · 2 comments
Assignees
Labels
enhancement feature Request to add some feature

Comments

@emurilloEcourbes
Copy link

Description
I have a device where I pull the data using API Rest. The API uses OAuth 2 with the client credentials flow

For obtaining the token, I execute a POST request to the provided address (e.g. /api/token)
The request headers must contain: Accept: application/json
The request body must specify the client id, the client secret and the client_credentials grant type

Once I have obtained the token, I must supply it in each API call.
The request headers must contain:

Accept: application/json
Authorization: Bearer {token}

I don't know how to do it in the IOT gateway.

Environment

OS: Ubuntu
ThingsBoard: 3.5.1
Browser: Chrome

@samson0v
Copy link
Contributor

Hi @emurilloEcourbes, thanks for your interest in ThingsBoard IoT Gateway!
If you using Request Connector, you can use httpHeaders config parameter and configuration will look like:
image

More information about Request Connector in the official documentation.

@emurilloEcourbes
Copy link
Author

Thnaks @samson0v for your reply. In my case the token expires in 3600 seconds, it's a third party application so I can not modify it. What is the best way to refresh the do it?

@imbeacon imbeacon added enhancement feature Request to add some feature and removed help wanted labels Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature Request to add some feature
Projects
None yet
Development

No branches or pull requests

3 participants