Can you set a value to event.transaction.redirect_uri in a post-login action?

I’ve written a post-login action and have implemented the onExecutePostLogin and onContinuePostLogin functions. In those functions, depending on who the user logging in is (which of two apps he’s allowed to access, or both apps) I want to send him to a particular URL.

In other words, I want to change the redirect_uri that the login was initiated with, based on who the user is.

I’m operating under the following assumption. In either of the two functions, I should be able to do something like this:

event.transaction.redirect_uri = 'https://theSelectedUri';

Does that actually do anything? My assumption is that when login completes and the user has been authenticated, that’s where he will end up, regardless of the original URI configured for the login.

Please note, I am not talking about performing a api.redirect.sendUserTo. My understanding of that is that the user is redirected with that before authentication is completed, so that custom things can be done in an external page. That’s not what I want to do.

I want to figure out who the user is, where he should go, and then send him there.

In short, is event.transaction.redirect_uri only readable, or is it writable as well?

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!