Http Response sendRedirect

I have a java action with a java servlet where I have to redirect a user to a 3rd party login page. The HttpServletResponse I get from HttpServletResponse response = context().getRuntimeResponse().get().getHttpServletResponse(); is shown here, and appears to be what I want after I call: response.sendRedirect(authorizeURL); The response: $latestHttpResponse/Content: HTTP/1.1 302  Date: Thu, 05 Jul 2018 18:21:32 GMT Cache-Control: no-store Content-Type: application/json;charset=utf-8 Set-Cookie: JSESSIONID=node0166ugfzznopli4widtwsq6lys0.node0;Path=/ Expires: Thu, 01 Jan 1970 00:00:00 GMT Location:   However the app says "A connection error occurred, please try again later." and in the Mendix Console I get a Client log node error: Failed to fetch Error: Failed to fetch     at new t (http://localhost:8080/mxclientsystem/mxui/mxui.js?636663864373994195:46:108020)     at http://localhost:8080/mxclientsystem/mxui/mxui.js?636663864373994195:46:21997     at http://localhost:8080/mxclientsystem/mxui/mxui.js?636663864373994195:20:1623     at Object.throw (http://localhost:8080/mxclientsystem/mxui/mxui.js?636663864373994195:20:1728)     at s (http://localhost:8080/mxclientsystem/mxui/mxui.js?636663864373994195:20:581) This is from when I run locally, but I get the same error when running from the cloud. How can I redirect to a dynamic external URL and receive a response? If I just take the dynamic redirect URL and go there from a link on the homepage, I am unable to receive the context or login credentials of the response. I think I may need a request handler, but the documentation I found doesn't make it clear how to use them for external URLs.    
2 answers


I have tackled this kind of requirement in the past using DeepLink and URL Redirector.  To provide Oauth authentication into third party tools (Microsoft Dynamics in one case), I:

  1. Import both DeepLink and URLRedirector into my app from the appstore
  2. Configure DeepLink per the documentation
  3. Create a simple page with the URLRedirector widget on it (inside of a dataview with an object)
  4. Open the page with an instance of this object created as in the screenshot below
  5. Build the microflow that gets called when the Redirect URI (which is a DeepLink) is called by Microsoft Dynamics.  In the case of Dynamics or any OAuth app workflow, the first response form Dynamics contains a token used to get an authorization key that is used for subsequent requests.

I realize this may not be the requirement you have, but thought this may give you some ideas about how to proceed.

Hope that helps,



I think some additional pictures might help.

Here is my DeepLink configuration:

and here is the microflow that this deeplink is mapped to:


I was able configure the deep link as well as URL Redirector as per the documentation. Here is the flow

  1. The URLRedirector redirects to my custom login service. 
  2. The Custom Login Service redirects back to a deep link
  3. My Custom Login Service has a token in the response that it sends to the deep link


But, I am not sure how to access the response body within the microflow that deep link maps to. Any help would be appreciated.