[DeepLink]Continue Redirect after Login for Local User(not SSO)

Hi guys,   Would love to get some insight on whether this is possible. If it is, would appreciate if someone could point me in the right direction.   So I have set up the DeepLink module (v9.0.3) and the deeplink URL in my email notification redirects users to my custom login page(if anonymous) and if you are already logged in, redirects the user to the intended form correctly.   However, my Question is if it is possible to continue the redirect to the intended form AFTER anonymous user logs in. At the moment it doesn’t retrieve any pending links so it just redirects the user to the homepage.   So the hyperlink in the email notification upon clicking opens the custom login page, and the anonymous user proceeds to enter login credentials. After successful login, it just goes to the homepage. How do I get it to continue to the form?   I know we can modify the LoginLocation constant to continue after SSO login.   Any help would be much appreciated.   Thank you!
2 answers

Right, this was a tricky one… 


I implemented this in Mx 8 but I presume the same is required for Mx 9 so hopefully this helps.


I did this some time ago so hopefully I don’t forget any steps.


Essentially you need to make 3 changes for this to work correctly – 

  • Make sure your custom login page has got the URL field specified
    1. E.g. /login


  • Set the LoginLocation constant in the Deeplink module
    1. This will ensure that your target url is appended correctly
    2. E.g. “../../p/login?cont=”
      1. The above URL will need to resolve to your custom login page setup in step 1



  • Add a Javascript snippet to trigger the redirect


Paste in the below script – 


window.mx.afterLoginAction = () => {

  if ( window.location.search.startsWith('?cont=') ) {

     window.location = window.mx.homeUrl+decodeURIComponent(window.location.search.substring(6))

  } else {






This will redirect to the URL provided on the deeplink once successfully authenticated.


Give that a kick and hopefully it solves the problem.





Hey Kevin Soh,

you can check this https://forum.mendix.com/link/questions/116851