Deeplink - Use of custom login page via deeplink constant LoginLocation

1
Hi. I have implemented a usage of Deeplink to direct users to certain pages within my app. Anonymous users are not allowed, so if the user is not already logged in they need to be directed to a login page. Deeplink has its own local login page which I do not want to use. I want to use the Custom login page for my app which is a based on the login widget. Everything with the deeplink works fine and if I leave the Deeplink constant LoginLocation empty I get the Deeplink login page served and the user can log in and is directed to the correct page. I cannot find a way to be able to introduce my Custom login page into the flow instead of the Deeplink one. Is it possible? Can someone suggest a solution?
asked
2 answers
1

This is what worked for me:

  1. Give your Custom Login Page a URL e.g. ‘login’. Set the Deeplink.LoginLocation constant to “../../p/login?cont=” 
  2. This is not enough as once the user logs in, the redirect is not correct. To fix this add the following javascript (using an HTMLSnippet or a JavascriptSnippet) from the app store to your custom login page
window.mx.afterLoginAction = () => {
  if ( window.location.search.startsWith('?cont=') ) {
     window.location = window.mx.homeUrl+decodeURIComponent(window.location.search.substring(6))
  } else {
     window.mx.redirect(window.mx.homeUrl);
  }
}

Hope this helps

answered
0

There is some similar question raised and the answer was upvoted. https://forum.mendix.com/link/questions/99330

There are some documentation available for setting the constant:

https://docs.mendix.com/appstore/modules/deep-link#2-7-constants-optional

https://appstore.home.mendix.com/link/app/43/

But having said all these, the last solution I tried and worked when I faced the same problem was, customizing the deep link login page to suite my default login page. Works seamlessly.

answered