I’m having some troubles with the Oauth2 method in a HTTP Node, used to connect to Microsoft Graph API. The issue is that n8n is apparently not requesting to renew the token when the old one has expired. I need to reconnect manually about every hour… I have tried everything, to no avail, including adding the access_type=offline parameter in the query.
Error: “code”: “InvalidAuthenticationToken”,
“message”: “Access token has expired or is not yet valid.”
Please share the workflow
Information on your n8n setup
n8n version: 0.176.0
Database you’re using (default: SQLite): POSTGRES
Running n8n with the execution process [own(default), main]: own
Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker
Sure, for security reasons I’m just disclosing the HTTP node that makes the OAuth refresh token request. But the principle is the following:
Retrieve the access token and the refresh token previously stored on a datastore (local file, database, etc., this is up to you and your standards)
Make the HTTP request to Microsoft’s token endpoint with the correct scopes
Replace the newly received tokens on your datastore
Return the HTTP response to the master workflow with the new tokens
**Please note that this only adresses the refresh token issue. For the initial authorization code request, you will need to do it on your own in order to 1/ redeem the authorization code and then 2/ to redeem your very first access token as described on the Microsoft’s documentation.
Hello @BramKn , thanks for answer me.
I guess this topic is perfect for my issue, but if there is no problem I can create a new one.
My main issue is to understand how to config http request with oauth2 credentials
It is better to open a new topic and maybe refer an old topic.
It is especially important to explain your case and let us know what you setup is like.
In 6 months a lot can change, and you give no information on the actual problem just the error, which doesn’t tell us a lot about what is going on.
If you want a quick and good answer, you always need to provide as much info as needed, screenshots also help.