Deeplinks LoginLocation -

0
What’s the way to get the deeplink to show a custom login page before proceeding to the deeplinked location (after successful authentication?) My custom login page has a URL set to “/login” I tried using “’” for the LoginLocation constant, and end up being redirected to a mendix login page I tried using empty for the LoginLocation constant, and get redirected to a mendix login page (same as above) When I use “/login/” the deeplinks direct to https://appname.com/login/link/action?params=param1 - When I use “login.html”, the deeplinks direct to https://appname.com/link/login.htmllink/action?params=param1 which ends up failing. I consulted the deeplinks documentation (here: https://github.com/mendix/DeeplinkModule) and didn’t see any useful information there in this regard. Is there a way of achieving what I'm trying to do without using the deeplinks module? If using deeplinks is the preferred approach, then can someone point me in the right direction, or better documentation that might get me unstuck?
asked
2 answers
2

This is what worked for me:

  1. The Deeplink.LoginLocation constant is set to “../..?cont=” this redirect the user to the custom login page. If you use a page URL for the login page then adjust the constant accordingly to e.g. “../../p/login?cont=”
  2. This is not enough as once the user logs in, the redirect is not correct. T fix this add the following javascript using an HTMLSnippet or a JavascriptSNippet from the appstore 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
1

Hi Sid, 

You're correct about using the LoginLocation constant, but the value should be "../login”. Your request handler should support a parameter ("cont” of continue is most used) so the handler knows to redirect the user back to the deeplink module with a user session. The LoginLocation constant should be "../login?cont=” and the deeplink module will paste the requested deeplink at the back.

Maybe a little complex but take a look at the SAML module how it's implemented in the java, because for the SAML module the LoginLocation constant should be “../sso/login?f=true&cont=”

Success!

 

answered