Hi Team, Am quite new to n8n and so far loving it. However would like to know if there’s any mechanism to share the data between the Nodes
Describe the issue/error/question
Am building a workflow for Foxy.io . I created one Foxy Webhook Trigger Node which will be listening to the event happening in the store. Rest of the child Nodes will be accessing/adding/modifying the resources in Foxy store.
Am planning to generate this SDK object inside trigger Node and use this object in subsequent child Nodes without regenerating it for each of them. Is it possible to share this object with child Nodes? Or the only option available to me is to store it somewhere inside database/file system? Also I don’t want the user to be asked for the refresh_token/secret and client_id in each Node.
I did quite a search in the documentation and forum but can’t find anything.
Am sorry if am overlooking something here.
Please share the workflow
Hi @wilson ,
welcome to the community
It looks like your foxy api is using OAuth 2 to authenticate a client. Did you create a
foxyOAuth2Credentials file to share credentials between your api nodes and trigger nodes? As a reference you can checkout one of the following:
Checkout the OAuth2Api.credentials.ts base class that is extended by all other OAuth2 credentials.
If you create
foxyOAuth2Credentials you can connect using n8n’s credential screen. n8n will automatically refresh the access token in the background. Sometimes it’s necessary to add additional
access_type=offline to get a refreh token.
Once you have created
foxyOAuth2Credentials you can use
const credentials = await this.getCredentials('foxyOAuth2Credentials');
to access your credentials including the access token.
I am not experienced with using the foxy sdk. Can you use an access token created by n8n OAuth2 credentials to make api requests? This way you could bypass any authentication done by your sdk and use
Also n8n will launch different processes by default to execute workflows. So simple singleton implementations to reuse authenticated sdk objects wouldn’t work. If you reuse our credentials and initiate your sdk on each execution the overhead shouldn’t much.
Hey @marcus ,
Thank you so much for the prompt and detailed response.
You guys are awesome, seriously, and you are doing really great work.
Sure I’ll have the reference of other Nodes and will try what you suggested and let’s see how far I go before bugging you again. (I will try not to though )