Describe the problem/error/question
We have a GraphQL API that uses OAuth 2 for authentication and when the JWT token expires, the API returns a 200 with a nested error message. e.g.
Status: 200 OK
/ Body: {"Errors":[{"message":"Token verification failed: jwt expired","path":["path"],"statusCode":401}}],"data":{"path":null}}
I learned a while back that n8n expects a 401 when a token expires, so it can auto-renew the credential.
My question is: for GraphQL APIs specifically, the practice we use is to return a 200 with a nested error message because the call itself was successfully rejected. We would only return a 200 or a 5xx in general. Is there a way to identify a credential as a GraphQL credential so it can check that error message? If not, how difficult is it to create a ‘custom’ credential type on our end that would do that?
What is the error message (if any)?
JWT Token Expired (after 60 minutes)
Please share your workflow
- Create a credential and authenticate against our OAuth Server. (Authorization Code Type)
- Create a workflow that uses the credential
- Execute the workflow successfully for the initial token timeout period (60 min in my case)
- Workflow begins to error out due to JWT token expired after that time.
Information on your n8n setup
- n8n version: 1.52.2
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Linux/Ubuntu
edit: corrected n8n setup formatting.