how to get client ip address in mendix 9.22?

0
new to programming, not very familiar with java how can i get the client ip address? if using the java action, where do i put the code? i’ve seen other answers to this question but they are from other versions of mendix that support the httprequest module and mendix 9.22 doesn’t.
asked
2 answers
0

The easiest thing is to to call an External API which responds back with an IP Address of the caller.

Now i looked around but couldnt find any that is quite clean and useful.

So i made one for this :)  It is a simple API to which you can make a GET request from your Javascript Action and the response is in JSON format. One example is below.

 

{"client_ip_addresss":"111.111.111.111"}
  1. So make a Javascript Action in which you can write the below code to get the IP Address
// BEGIN USER CODE
    const response = await fetch("https://polite-kashata-ea7b05.netlify.app/api/address");
    const jsonData = await response.json();
    return jsonData.client_ip_addresss;
// END USER CODE
  1. Put a button somewhere which can call a Nanoflow which has an Action of type Javascript Action Call

Let me know how it went

answered
2

Hi Corina,

If you want the client's IP address you can get this using a request handler. There is a module on the App Store called IP Validation. Which checks an IP address on login

 https://appstore.home.mendix.com/link/app/1752/ 

 

And if this doesn’t help you might wanna have a look at this question also,

https://forum.mendix.com/link/space/other/questions/5846

 

Hope it helps!!

answered