User Roles Not applied after Deeplink login

I am developing a mendix app that needs to have a deeplink onto the login page. i am using a custom microflow that uses a java action to log the user in.  After the Guest user Logs in they should be become a logged in, then i use the URL Redirect widget to navigate the user to their home page. The user and lands on their correct default home page, to search for profiles returned via a REST call. after logging in  they are directed to the correct home page where the search functionality is and the search correctly returns results. When clicking the button to view the search result, the microflow triggers correclty and completes as expected, however after the flow completes the mendix progress bar remains on the page indefinitely until you manually refresh the page. Upon inspecting the browser console, i see error messages stating "mxui.js?636091019438068756:9 No permission to read or write entity MyModule.MyEntity, check security!". My guess is that somehow the browser is not removing the session for the anonymous user. But since mendix redirects to the correct user role home page i dont see how this can be happening.   Here is the code for my login java action:   boolean Result = false; Core.getLogger("JLogin").info("Attempting Login..."); ISession session; try { session = Core.login(Username,Password,getContext().getSession().getId().toString()); if(session.isInteractive()) { Result = true; Core.getLogger("JLogin").warn("Login Success"); } } catch(Exception e) { Core.getLogger("JLogin").warn("Login Failed: " + e.getMessage()); } return Result;  
3 answers

The most likely cause would be the entity access not being set up correctly.

Have you checked the user has a user role which allows it to read/write the MyModule.MyEntity entity in the entity access rights of the module? Also make sure the project user role has the correct module roles assigned to it.


Ryan, please have a look at how the original code in the deeplink module handles this. You will need to set new session cookies after creating the session, otherwise, your browser will still use the session cookies for the existing anonymous session.

Also, please do not use hardcoded strings like "JLogin" , make this a constant :).


Hi all, just letting you know that i found a solution for this issue. the problem was indeed that the session was not being cleared and there fore the module roles were not recognized by the modeler. The way i resolved this is as follows :

1) Instead of simply showing the home page where the search was executed, I linked my non-persistable loginTemp entity to the MyModule.MyEntity using association to the account entity, and after this i use the URL redirect to direct the user to their role based home page(this seems to clear the session).

2) on the home page microflow for the logged in user role, i created a Data Source microflow.

3) in the Datasource microflow, i check to see if this association is set between account and my loginTemp Entity.

4) if the association returns results i direct them the the deeplink page, if the association is empty i simply create a blank new MyModule.MyEntity and send this through to the page, if it is not empty, i create a pre-populated version of the same entity and use this to call the rest function.


Thanks to all for their help in resolving this issue!