Custom "hybrid" credentials

Hi,

I’m going to create a custom node for FileMaker dataAPI.
This API uses a mixed auth method :

  • First we need to login using basic auth + post body
  • The login request returns a session token
  • All other endpoints uses this token as bearer auth.

Ideally, I would like to “hide” this authentication process and share the token with all nodes of a workflow.
My questions are :

  • Is there a way to achieve this ?
  • Is there any kind of “cache” or “session variables” I could use to store/share the token during the workflow (other than nodes data) ?
  • Is there some kind of “destructor” at the end of workflows I could use to “logout” automatically ?

Sorry for the late answer but the last days were specifically stressful and first had to think about your question a little bit more.

It sounds for me partly similar to how some authentications via OAuth work. Sadly nothing exists for that yet. Even though I think it is really important to support such authentication methods but sadly did not find time to work on it yet.

What you can use is static workflow data. You can find some documentation about it here:
https://docs.n8n.io/#/nodes?id=method-getworkflowstaticdatatype

Is for example used by some trigger nodes to save webhook ids like here:

Anyway would not be the best thing to do as this data gets saved unencrypted with the workflow. As there is also no “destructor”, so there is also nothing that would delete it before it gets saved. Think currently there is no easy and clean way to do that. Something really has to get build for n8n first which adds support for that properly.

No problem! We all have many stuff to deal with!
Thanks for that detailed answer. For sure, oauth is a must have to help n8n growth.

For now, and that specific case, I’ll try to deal with it.
Perhaps as a first step, it would be fine to be able to set custom variables in the credentials object during the workflow. Theses custom variables would live only during its execution and get destroyed at the end (I don’t know if it’s technically feasible as I’m not yet confortable with all n8n concepts)