Authentication & Login via External REST API

Hello Mendix Community,   I am working on a project using the free version. One of the goals is to implement authentication via an external REST api.   More specifically, I would like to build a login page where the login button should trigger a microflow. This microflow should perform a REST POST request to authenticate a user on the provided username and password. If the user is authenticated, then he redirects to a home page.   Is this possible to implement the previous logic in Mendix? If so, could you provide me some steps?   If this goal is met, then the next step, is to add logic regarding login token’s expiry duration which will lead in the user being logged out after some specified period.   I would be grateful if you could help! Thanks in advance!   Best Regards, George
1 answers

Hi George, you can:


  1. create a custom login page (thus not the default html page, but a specific page in Mendix)
  2. on this page, add a form with 2 inputs for the username and password
  3. use a nanoflow action on the login button
  4. in this nanoflow do the REST call
  5. if the REST call has a succesful callback, execute the Login action


I should mention that for user authentication, you can build something like this manually, but you can also look to the industry standards like OIDC.

Mendix has a great marketplace module for extending the user authentication through OIDC or SAML


Hope this helps.