How can I set that fields value is updated from two different modules?

I get that the title is a bit obscure.

In my error handler, I want to re-authenticate and get a new Bearer token to be used in the request. This means that the module doing the request needs to have the bearer token from the first module, and after error handling to use the token from the error handler instead.

Here’s the abstracted picture:


From left to right:
(13) Get a token (btw, getting a token is some custom http call, not this generic one)
(14) Use the token in the HTTP request
(15-16) if error is not 401 stop executing
(16-17) if error is 401 do authenticating again, generating the new token
(18) retry the (14) again

The problem I’m having is in (14) - how can I set the token to be the one from (13), and after error handling to be the one from (17)?

I thought setting a variable would do it, but it seems that’s not it - it’s not a “global variable” that I can set in one or the other module, because when choosing a value I have to specify which module is it taking it from.

Any ideas how to solve this?
Thanks

We resolved the issue over a call with Make support. The resolution for my case was to use Custom variables - Team scoped.
What I did is to create a new custom variable in the Team (open Team settings, then Variables), and then I created a new scenario that has only two modules and runs every 59 minutes (because my tokens expire in 1h). The first module obtains the token, and the second one (module is named “Make” / “Update a custom variable”) sets the custom variable to the value of the token received.
Then, in my original scenario, I can reference the custom variable. With this, I basically ensured that every time a module is executed it will use the token from custom variable.

Additionally, in order to fix the “incomplete executions” queue (which can sometimes be quite long) I added an error handler which will just go and retry if the error is 401, specifically:
“add error handler” → add module (router)
→ branch 1 (if message contains 401) → break with retry 3 times every 30min;
→ branch 2 (if message doesn’t contain 401) → break with retry once;

1 Like