Custom grant_type in oauth2 credentials

The idea is:

Support for custom grant_types in ouauth2 credentials, and the option to create a handling for this grant type as a module.

My use case:

We need impersonation in our solution
So we want to achieve RFC 8693: OAuth 2.0 Token Exchange (
We implemented it in our api, and want to utilize the n8n framework as much as possible.
We managed to create n8n credentials whith the custom grant_type, but now we need to be able to provide code for this grant type.

I think it would be beneficial to add this because:

Impersonating users to act on their behalf against a 3rd party would enable

  • Permissions checks against the user, instead othe workflow engine.
  • the user shows up in any logs