I’m trying to connect to an API in the best way possible.
They use OAuth2 and Bearer Tokens with a “expires_in: 86400” variable, meaning I have to generate a new token every day, right?
I can obtain the Bearer Token separately and simply use it with a Header Auth credential. But I probably should create an OAuth2 credential, because of the toekn refresh interval.
When trying that, I can’t find the “Authentication URL”. Only the Access Token URL.
Hi @solomon, I no longer work on n8n I am afraid and am just a user. I do not speak Portuguese either unfortunately, so can’t easily review the link you have shared. However, I do know that n8n tries to automatically renew OAuth2 tokens when they expire and stop working.
Based on the “rejected” response on your last screenshot without an error code I think there is a good chance the problem is within this OAuth2 flow, and not a direct response coming from the URL specified in your HTTP Request node. This in turn suggests there might be room for improvement around OAuth2 error handling and surfacing.
Until this happens I do not know what exactly is causing the error here, but I think possible next debugging steps here could be to add a lot of console.log statements to n8n’s OAuth2 code to confirm 1. exactly what request n8n is making here, and 2. what the exact response coming from your API is.