Refresh Auth Workflow not recognizing variables from previous workflow (Retool)

  1. My goal:
    I want to use the refresh_token obtained in my Auth workflow inside a separate Refresh workflow, so I can automatically get a new access token without hardcoding the refresh token
  2. Issue:
    Variables from the Auth workflow, e.g., REFRESH_TOKEN, are not recognized in the Refresh workflow.
  • If I hardcode the refresh token in the POST request, it works.
  • But when I try to use the variable REFRESH_TOKEN, the workflow fails.
  • I don’t know how to properly pass variables between workflows in Retool.

3) Steps I've taken to troubleshoot:

  • Tried different ways to reference variables in the Refresh workflow (e.g., http2.body.refresh_token).
  • Checked Retool documentation and forums, but didn’t find a solution.
  • Defined global variables

4) Additional info:

  • Cloud-hosted Retool.
  • Auth workflow works fine by itself.
  • Refresh workflow only works with a hardcoded token.

Hi Gabii,

Sorry to hear you've been running into this, and thanks for sharing those screenshots!

It looks like your tokens are being saved correctly since the Custom Auth Defined Variables modal confirms Retool is persisting them for that resource.

The failure is most likely how the refresh body is built in the body params of your Refresh auth workflow. Try adding quotes around {{ REFRESH_TOKEN }} so it looks like this:

{
     "refresh_token": "{{ REFRESH_TOKEN }}"
}

Retool needs the variable wrapped in quotes so it gets treated as a proper string inside your JSON (which might be why hardcoding the refresh workflow works but the variable doesn't).

If that still gives you trouble, another option is to set the body query type to Javascript and return it like this:

return { "refresh_token": REFRESH_TOKEN }

If neither of these fixes work, could you paste the exact error message you're seeing in the Refresh step so I can help you debug further?

Keep me posted! :slightly_smiling_face:

Cheers,
Branden

Hi Branden,

Thank you very much for taking the time to answer my question and for suggesting those solutions! I really appreciate it.

I tried both approaches you mentioned:

  1. Wrapping {{ REFRESH_TOKEN }} in quotes:
{
     "refresh_token": "{{ REFRESH_TOKEN }}"
}
  1. Using the Javascript body query:
return { "refresh_token": REFRESH_TOKEN }

Unfortunately, I am still getting the same error when I run the Refresh Auth workflow.

Could you help me debug further? Here is the exact error message I see in the Refresh step:



Thanks again for your help!

Best regards,
Gabii

Thanks for giving those solutions a try. :slightly_smiling_face:

I noticed in your screenshots that the Body query type is set to "Raw" - this might be causing the variable evaluation issue.

Can you try switching the Body query type from "Raw" to "JSON" and then remove the quotes/brackets around REFRESH_TOKEN? So your body params would look like this:

{
     "refresh_token": REFRESH_TOKEN
}

I have a feeling that in Raw mode, Retool was sending the literal string "{{ REFRESH_TOKEN }}".

Let me know if that works. Happy Friday!

Thanks again for the quick reply and the extra tip! :pray:

I switched the Body query type from Raw to JSON as you suggested, and updated the body params to:

{
  "refresh_token": REFRESH_TOKEN
}

Unfortunately, I’m still getting error. Here are two fresh screenshots showing my setup and the error I get:


Thanks again for helping me debug this — really appreciate your support!

Hey Gabii, I'm sorry to hear your refresh token variable still isn't recognized in your refresh workflow.

I've gone ahead and submitted this internally to see if I can get some additional eyes on this. I'll be monitoring this closely and will get back to you as soon as possible!

Thank you so much for escalating this and for keeping an eye on it! :pray:
I really appreciate the support and I’ll wait for your update.

Hey,

Is this issue resolved? I’m also experiencing a similar problem.

1 Like

Hi Sunil_Mahendra,

Thanks for sharing that you're running into this too. Our engineering team is looking into it, but I don't have a timeline for a fix just yet. I'll keep you updated here as soon as I know more.

Thanks,
Branden

Hey @Gabii, thanks for reaching out. Based on the most recent screenshot that you shared, the params of the API request being made by the refresh flow may not be defined correctly.

1 Like

The following setup works correctly in my own testing.

1 Like