I’ve build (and gotten confirmed) a custom node 1Shot API. It creates its own credential type but it just extends the “oAuth2Api” credential with an added field. In our instance, we have defined 2 credentials, using different API keys, with different permissions. In our node, there’s some drop downs powered by our API, which should return different results based on the credential you have selected.
This isn’t happening.
When I switch from Credential A to B, no new token is being requested, and the token for credential A is presented to the system for the dropdown. This results in us returning a 403 forbidden response, which is correct. We have the node configured to return refresh the token when it gets a 401 response, and this works. But relying on that mechanism for managing multiple credentials just doesn’t make sense to me. I would wager that if I switched the credential, got a 401 response instead of 403, that it would refresh the token using Credential B. Problem is, we have multiple workflows with different permissions and need tokens for A and B, having to fail a call first to trigger a switch is not going to work, besides the fact that I’d have to change the error codes in our whole product since I can only specify a single refresh the token error.
I’m hoping I’m missing something here. I’ve been looking in the n8n source code but I’m not seeing it. AI hallucinated a “uniqueIdentifier” requirement, but that should just be the internal CredentialId. How can I make n8n track a unique token for multiple instances of credential types?