Read custom HTTP header values from Actions Triggers

Hello,

My requirement is to read a custom HTTP header from the Token request (Or from the authorize) and implement a logic in action based on that custom HTTP header value. But it seems like there is no possibility of read any custom HTTP headers, Even the event object dose not contains anything related to headers[1].

Is there any possibility to read a custom HTTP header from Action? For an example i need to read X-CUSTOM-HEADER header value from the token request.

As well as set a custom header from action. One requirement of this is to set a custom HTTP header for logging purposes

[1] Actions Triggers: post-login - Event Object

2 Likes

Hi @shagihan,

Welcome to the Auth0 Community!

I understand that you are looking for the header value using Actions.

To do so, you will need to call the event.request.user_agent property to get the header received when initiating the transaction.

See our Post Login Event Object documentation for more details.

Please let me know if you have any questions.

Thank you.

Hi @rueben.tiow, It is only have information about the user agent (Eg. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36\n)

What i’m sepecifically looking for is to define a custom header such as X-TRANSACTION-ID and log the value of that header in a custom action. Will it be possible?

1 Like

Hi @shagihan,

Thank you for your response and for checking the Action property.

After looking into this further, I did not find any way to use Actions to get or set the header values from the Authorize request, as you observed.

With that, could you please elaborate further on the rationale for implementing custom logic for getting and setting custom headers?

And could you please clarify your use-case? Perhaps there is an alternative strategy we could explore.

Thank you.

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.