Skip to main content

Hi,

My application returns a token in the Basic Auth response. I have to pass that token in trigger polling request. How can I achieve this?

 

Thanks

Srinivas

Hi @srinivas.panyala - Basic Auth doesn’t requires another token to authenticate except for the base64 of `${username}:${password}`. So maybe you should use “Custom” or “Session” auth instead so you can have more control over what is stored in bundle.authData. Any object that you return from the perform method of the auth type you choose, will be saved in bundle.authData. So in future requests, you can look for that token in bundle.authData before sending the request. I hope this answers your question.


Thank you so much for your response. I agree “Basic Auth doesn’t require another token to authenticate except for the base64 of `${username}:${password}`”. My question is about the Basic Auth response. Is there any way to save Basic Auth response in a variable and use that variable in Trigger polling request? I am not using CLI.

Thanks

Srinivas  


@srinivas.panyala - Yes, Session auth is also available in the UI. You can use it to achieve what you want, but you’ll have to calculate the basic authorization header yourself. Make sure you add the username and password input fields, and in the Step 2: Configure a Token Exchange Request, switch to code mode, add some logic to calculate the token which is the base64 of the username:password combination and set it in the Authorization header in the format: “basic <token>”. And make sure to return an object that contains the token that you would receive from the API. It will be stored in bundle.authData which can be retrieved when you make future requests from a trigger or an action.


Thank you so much. I will follow this approach.