-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Automatic refresh a Bearer ACCESS TOKEN in inputs.http #11279
Comments
Hi @JornDL the |
Hi @Hipska Can you help me on how to do that, please. |
Updating a file? It seems like it isn't even needed when I look at your initial description. It appears that You want to use an Oauth2 service: ## OAuth2 Client Credentials. The options 'client_id', 'client_secret', and 'token_url' are required to use OAuth2.
client_id = "clientid"
client_secret = "secret"
token_url = "https://api.netatmo.com/oauth2/token"
# scopes = ["urn:opc:idm:__myscopes__"] |
Hello! I recommend posting this question in our Community Slack or Community Page, we have a lot of talented community members there who could help answer your question more quickly. You can also learn more about Telegraf by enrolling at InfluxDB University for free! Heads up, this issue will be automatically closed after 7 days of inactivity. Thank you! |
Hi @Hipska I don't think that you read all my first mail, because To get access the user has to do a POST to receive an access token and refresh token from Netatmo. As they they are only valid for a certain time period, the user has to renew them from time to time. To gather data the user has to do a GET with just the device_id and the access token. I had to write my own bash script to receive and renew my access tokens, as Telegraf inputs.http can't do it. |
This issue merits revisit, as there are other REST API's out there that expire tokens at regular intervals. Telegraf should have a mechanism for renewing the bearer token. |
There are more APIs (e.g. WeatherXM) which work similarly and can't be used in HTTP input plugin by convenient way when Bearer token refreshing isn't supported... |
Can't reopen this issue, so create a new one here, feel free to jump-in and help me to convince developers that this is an important part of the HTTP plugin features set. |
Feature Request
Make it possible to refresh a Bearer ACCESS TOKEN in inputs.http
Opening a feature request kicks off a discussion.
Proposal:
To make this possible in inputs.http:
Current behavior:
[[inputs.http]]
urls = ["https://api.netatmo.com/api/gethomecoachsdata?device_id=MAC-ADDRESS"]
headers = {"accept" = "application/json"}
headers = {"Authorization" = "Bearer ACCESS TOKEN"}
This works fine as long as the Bearer ACCESS TOKEN has not expired
Desired behavior:
Automatic refresh of the Bearer ACCESS TOKEN so it does not expire
Use case:
All cases where the Bearer ACCESS TOKEN expires.
Example from Netatmo:
The text was updated successfully, but these errors were encountered: