Why localStorage is not in workflow?

Hi all, i cannot run localStorage.setValue in workflows? Anyone can help ?

Hi @peanutbutter7203

LocalStorage is a place to store data locally to the browser, thus you might have different data across users, devices, and sessions.

Workflows, on the other hand, is server-side, and need to rely on central storages, i.e. a database.

If you need to keep persistent to App users a Workflow result, use the database.

Hope this help.

1 Like

Also in workflows the data from all previous blocks are available, so you could have the block return whatever it is you were trying to set into localStorage and then refer back to that later in the workflow.

Can you describe a bit further what you are trying to accomplish with localStorage that is giving you a headache in the workflow?

Do you mean I can get the last run workflow data ? I can only get the authorised token without sanitized in workflow.

I want to set the sanitized token into the localStorage. The token can only send to workflow

Are you trying to pass the token back to the app? If so you can have the response block include the token and then in the app add an event to the "On success" that sets the appropriate part of the response with the token into localStorage.

I have a custom auth workstep in resource that will curl webhook workflow and pass the token headers to the workflow.

In workflow I set the response? But how my app can get the response without trigger it from my app side ?

If you are passing the token into the workflow from the App, put the token into the startTrigger body and then trigger the workflow with a script or an event.

The workflow is triggered by webhook from custom auth resource, not from the app.

Is it possible to get recent workflow run data without triggering it ?

Hey @peanutbutter7203! It looks like your original question has been answered but I wanted to hop in and resolve any lingering questions you might have. Many thanks to @abusedmedia and @jg80 for the support! :tada:

If you are running an On Prem version of Retool, it's possible to query the primary database for the data associated with previous workflow runs. I don't think the same can be done on Cloud and there isn't really an alternative, unfortunately.

Let me know if there's anything else I can help with!

am I wrong thinking an authorization token might be something you'd probably prefer to store in a secure cookie (sanitized or not)? I think you can do this in one of the auth worksteps, so if you receive it un-sanitized you can just clean it yourself when you create the cookie... or no?

Not wrong at all, @bobthebear! With sensitive information like an auth token, it's definitely preferable to use something like a secure cookie. :+1:

1 Like