Oauth refresh token, best workflow?

I have a basic OAuth flow to authenticate with 3rd party API , after the authentication is successful, I use a delay node to wait for x seconds (expires_in property - 100 seconds) and then I push the message to refresh the token, and I am trying to keep that loop going, but after a couple of token refreshes, the node-red fails to authenticate. Is there any better way to make the flow?

does the token tell you when is it expiring? is it a jwt?

1 Like

Also, is it a public API, can you share?

Yeah it does.

Yes, its Airthings API

Are you sure you aren't exceeding the 120 requests per hour limit?

Probably, have too much organizations and around 900 sensors that i try to get latest data upon authentication. I have added delays so node-red won't hang but i think that may causing the problems.

Then you need a business account I think.

then what's the point of refreshing the token continuously?.
Why don't you just wait till it's about to expire and ask for a new one?

In addition to Airthings Webhook, we also scrape data every 7 days as a way of precautions, and push the data to an Influx database.
We use data from API such as sensor name, location, organization to pass it along with webhook live data.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.