Multi tenant different login pages for different tenants

1
We are trying to build a Multi-tenant Mendix application and the Multi-tenancy shall be handled inside mendix as an additional attribute on the Account Entity. But presenty, I am finding it difficult to work on below functionality.   Requirement: For each tenant we will give them a custom URl like            https://app.mendix.com/login.html?tenantName=tenant1             https://app.mendix.com/login.html?tenantName=tenant2 So now when user with tenant 1 URL logs in, it should show him a Custom Login Page with his Company Branding. (Imagining Login page layout would remain very similar, but some icons and images and branding would differ for each Tenant When tenant 2 user clicks on his URL, it should open his Login Page How can we achieve this? Currently, we have enabled Custom Login Page with Anonymous users. But it is always taking to mendix Login page.    We need to dynamically access the URL clicked before the Login Page is rendered and based on parameter in the URL, show different login Pages. We can do this after Login / authentication is done using Custom Login. But in our case we want the login page itself to be different for each Customer / tenant.   I have tried using Deeplink module, and also went through the documenation and referred to https://community.mendix.com/link/space/security/questions/99330 this Forum post as well. But the solution is not working.   I dont have a single Custom Login Page. I have multiple Custom login Pages and want to show them dynamically by identifying what is the tenant name in the URL when the URL is entered in the browser.   Ifi conifugre a Deeplink microflow, it first needs authentication.   Thanks & Regards, Aniketh
asked
2 answers
1

Deeplinks can work without the need to login, see the documentation on ‘Do not force login action’ here: https://docs.mendix.com/appstore/modules/deep-link/#34-adding-the-configuration-overview-snippet-the-custom-admin-page

All you would need to do is take the tentent info from the url as the input parameter for the deeplink microflow and make sure that based on this data the user is redirected to the correct page. Or even better maybe directed to the same page but with elements like logo’s etc that are set dynamically so that yoou do not need a different page for every tenant.

I do believe that using deeplink is the way forward and you’ll need to see what the issue is in your configuration.

answered
1

The deeplink should work for customized login pages, like Erwin said, but you’re getting in trouble when users logout or when browsers are redirected to the (?) login page when sessions are terminated or the application is restarted.

You may want to look into setting up multiple login.html files in the /theme/web folder of your project. Users then can login at <your_app_url>.login-tenant1.html, <your_app_url>.login-tenant2.html etc. Using the originURI cookie users should then be redirected to their own login pages when their session ends. I think Mendix sets this cookie automatically in login.js, otherwise you’d need to do that yourself using javascript in your login.html files.

answered