Read custom HTTP header values from Actions Triggers


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

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?

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.