How to save cookie?

I am migrating some work written in php to n8n.
The work is related to cookies, I want to login only 1 time and save cookies for later.
I don’t know how to do it in n8n yet, I plan to use getWorkflowStaticData or update directly to n8n’s mysql. Is it okay?

This is the model I am using, every time I run, I have to log in

This is the model I want, just login once and save the cookie for next time

Hey @admtpu!

There are two different ways. You can either store it in Static data or store it in Google Sheets/Airtable.

The advantage of storing it in Google Sheets/Airtable is that you can have another workflow that can delete the cookies and add a new one when they expire.

I was also planning to save the cookie to google sheet, but that only complicates it further, since it has to get the data from the spreadsheet. It’s the same as logging in and getting cookies.
Is there a way to update a node’s parameter in n8n, I want to set cookie this way

Hey @admtpu!

Then using getStaticData would make more sense in this use case.

1 Like