Custom auth flow is not saving the token

I’m following doc for setup custom auth in my retool application. Everything is working fine, except step 5 " Saving the Authentication Token". I’m trying to set a variable name PASSWORD from my response JSON but it’s always showing undefined. I’ve tries multiple ways to access it but every time it reacts the same.

My login response structure:-
Using token in a header:-
Define a variable:-
I also tried {{http1}}, {{http1.body}}, {{}} and etc… but everytime it return undefined in PASSWORD.

Hey @tacenda and welcome to the forum! Thanks for the detailed screenshots.

Have you tried {{ }}? (or .name, not sure which you’re trying to extract). We might have erred in the docs there by putting .json instead of .data.

Hi @justin, Thanks for your reply.
Yes, I have tried {{ }} and I also tried some combinations with http2 instead of http1 but every time it sets undefined in password. When I set a hardcoded value then it works fine.

1 Like

@tacenda very strange. It does seem like you’re following the docs pretty much word for word, I’m not sure what the issue is. Could you attach a screenshot of the whole custom auth flow that you’ve built so I can see all of the steps?

HI @justin, Here are screenshots of my setup:-

  1. Set URL & Header :-
  2. Custom Auth Modal:-
  3. Custom API Request:-
  4. Define a variable:-

Also, Check the login response

I was tried to set a hardcoded value for PASSWORD under Define a variable and it put that value in header successfully but unable to set from login response.

@tacenda thanks!! I think the issue might be that you’re missing a step in the custom auth workflow - seems like you have two steps defined, and then a refresh step, where you’re defining your variable. Can you move the “define a variable” step to the workflow itself? It should be the third step, right after you make your POST request with the username and password.


Thanks @justin! It’s working.

1 Like

Woohoo awesome!!