Connect to an API with OAuth2 authentication

Hi all, I want to connect to a bank API with my Mendix app, but is secured with OAuth2. I can't find documentation about how to securely connect a user to such an API. Has anyone done it and if yes, how? Kind regards, Steve Jonk
3 answers


You can authenticate with OAuth2 – I just built a Microsoft Graph integration using (Microsoft’s version) of OAuth2.

I used the following from the appstore: URL Redirector, Model Reflection, Deeplink

The general steps are as follows:

  1. Initiate the OAuth process.  The user calls a microflow which generates a URL to call MSGraph (in my case) to start the process.  This URL will contain some query parameters.  You’ll call this URL by opening a page which has the URL Redirector on it, pointed to the URL you just created.
  2. MSGraph asks for the users consent and then calls a URL in my Mendix app.  This is where Deeplink comes in.  You’ll create this redirect URL in Deep Link (also you need Model Reflection so that you can set up the link). 
  3. The microflow called in step 2 calls Microsoft Graph again (with an authorization token provided by MSGraph in step 2).  The response to this call contains the final token I need to use to authorize MS Graph requests.

For reference, the DeepLink I defined for step 2 looks like this:

Also, it has the query params because the microflow looks like this:

The string params of the microflow are used as the query params of the Deeplink.

Hope that will help you get you started.




I did build a microflow that executes OAuth authentication a few months ago using a standard REST call with POST method, here is my example:

The input values were not as straight forward as I thought, I tested it for a while using postman before finding the correct values. For example, the request body required an extra field “undefined” but I cannot find the notes explaining why:


I hope that helps.





What exactly are you running into?

You should be able to perform the authorization calls using a consume REST Service activity in Mendix:

How the OAuth2 specifically works it not really specific Mendix question, I think there's enough to find about that on the internet…

kind regards,

Bart Rikers