I’m trying to access the Withings API using the HTTPRequest node. I managed to workaround their broken access_token system (Using a Webhook workflow conditioning the body of the message to have a conforming format). Now I’m struggling with token refreshing: I reliably get an access- and refresh token, but according to my workaround-webhook execution history, the token is never refreshed (the workaround is apparently only called once: when initially getting the access_token).
Do n8n OAuth2 credentials actually refresh the access_token or is something broken?
When you are using the HTTP Request node and select under “Authentication” → “OAuth2” and configure everything correctly it will refresh the token automatically as soon as a request gets made that returns that the used token is not valid anymore.
If you build your own OAuth “process” with Webhook and HTTP Request nodes, then you would also have to take care of the refresh yourself.
It makes a request and if “401” gets returned (which means “Unauthorized” and that the access token is not valid anymore) it uses the refresh-token to refresh the access token. That new token gets then used to repeat the request.
@jan I’m pretty flexible. If you want, we could do a video call where I demonstrate it, I can also give you full access to my n8n instance. The withings account can be recreated or I can give you my data. There’s apparently also a “dummy” parameter one can use when requesting a token.