Context:
I’m using the Instagram API “with Instagram Login”, instead of the Instagram API “with Facebook Login”. I already got a long-lived access code to use the Instagram API; I got the code directly from the app I created “Meta for Developers” dashboard. The long-lived access codes expires every 60 days, and I will have to manually refresh them in the Meta for Developers dashboard, and then manually update the credential in n8n to ensure my workflow continues to run.
By reading other questions in the n8n community, I understand I could schedule a workflow to use the HTTP Request node to access the API’s endpoint shown below and get a new long-lived token; however, that will show the new access code in plain text in the n8n Executions history. Also, I noticed that there is an n8n node to create credentials, but there is not an n8n node to update an existing credential, thus not sure how to enable a workflow that will get a new access token and then will update new access token in the existing credential.
https://graph.instagram.com/refresh_access_token
Questions
- Since the Instagram API uses the Oauth 2.0 protocol, is there a way to create a credential for the Instagram API using the generic “Oauth2 API” and configure it so that n8n automatically refreshes the access tokens before they expire (to avoid having to manually update access tokens)?
I noticed that in the form to setup the “Oauth2 API”, there is a field to input the “Authorization URL” and “Access Token URL” (which is used to exchange the authorization code for a short-lived access code); see picture below. However, I couldn’t find an option to configure the URLs for the Instagram API endpoints that allow to:
- exchange a short-lived token for a long-lived token
- refresh access token and have n8n automatically refresh the token before it expires
- If n8n currently doesn’t support auto-refreshing the Oauth2 credentials, what would be a recommended/best practice for enabling a workflow to auto-refresh the credentials?
Information on n8n setup
- n8n version: 1.107.4 (n8n Cloud)
