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!