I’m using oauth2 authentication on my HTTP node. Authorization is performed, running requests until the token expires. After expiring I’m getting a 401 error, as described below.
Can someone help me?
"error_description": "The access token is invalid or has expired",
Information on your n8n setup
- n8n version: 0.160.0
You’ll need to use the refresh_token from original authorization to refresh the token for that connection. I found some info here under Step 5 - Refresh Your Access Token
Yes, that’s the point. The token must be updated, but this is not happening on the part of the configured oauth2 credential.
Hi @woodyalan, welcome to the community
Many OAuth2 APIs require additional query parameters to issue refresh tokens (which can then be used by n8n to refresh the OAuth2 access token). In many cases (e.g. Google or Zoho) a value of
access_type=offline in the Auth URI Query Parameters field from your screenshot will do the trick.
Could you check the documentation of your API for any information on this?
Thank you @MutedJam!
By default the API that I’m using already provides the refresh token. I did a test setting up oauth2 authentication on Insomnia and the token was renewed automatically.
Hi @woodyalan, I wonder if Insomnia might implement some magic on its own here. Do you by any chance have a link to the documentation of the API you are using here so I can take a closer look when I have a bit of time?