Pass credentials to headers creating own node

Hello all the n8n community,

While creating my own node with credentials, all seems to work fine but I’m not capable to pass the credentials to the header.

but when I do console.log(credentials); where credentials is => const credentials = this.getCredentials(‘credentials’) as IDataObject;
it prints the credentials perfectly as I wrote it in my node.
‘credentials’ : ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’

How can I pass that exact credentials directly to the header?

Thank you very much, I hope I have explained myself good enough.

Hey @adricampi!

Welcome to the community :sparkling_heart:

The documentation might be helpful Creating your first node | Docs

Let me know if you need more help :slight_smile:

Thank you very much @harshil1712
I had already red the documentation but the method they use
'Authorization': `Bearer ${credentials.apiKey}`,
didn’t worked for me.
Fortunately, I managed to solve the problem by simply doing this. It may not be very elegant but it works:
header : credentials

Ah yes, the documentation is specific for the SendGrid API. I shared it with you for reference. You would have to modify the headers according to the API you use. Anyways, I am glad you were able to solve this! Have fun :tada: