Opening authorized deep links with custom login page - Mendix Forum

Opening authorized deep links with custom login page

6

When I try to open a deep link where the user has to log in, in an application with a custom login page, I will be redirected to the login.html page of the deep link module. This is a page without the styling of the custom login page, which seems odd to users and is not acceptable for them.

It would be nice if I would be able to use a deeplink where a user has to login, that can be used in combination with a custom login page. 

asked
2 answers

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

Created

I hope this gets implemented soon.

Created