# Auto login based on IP

**URL:** <https://forum.inductiveautomation.com/t/auto-login-based-on-ip/104173>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [March 25, 2025, 4:13pm UTC](https://forum.inductiveautomation.com/t/auto-login-based-on-ip/104173 "2025-03-25T16:13:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Metz](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@Kyle\_Metz](https://forum.inductiveautomation.com/u/Kyle_Metz)\
**Post date:** [March 25, 2025, 4:13pm UTC](https://forum.inductiveautomation.com/t/auto-login-based-on-ip/104173/1 "2025-03-25T16:13:07Z")

</div>

I have all the code correct and the auto login, but the problem I'm having is the [system.net](http://system.net) functions are returning the same address on different clients instead on the adapter ip of the device. tried getIpAddress and getExternalAddress.

---

<div class="post-metadata">

**Author:** ![Kyle\_Metz](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@Kyle\_Metz](https://forum.inductiveautomation.com/u/Kyle_Metz)\
**Post date:** [March 25, 2025, 4:20pm UTC](https://forum.inductiveautomation.com/t/auto-login-based-on-ip/104173/2 "2025-03-25T16:20:00Z")

</div>

It returns the address of the server

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 25, 2025, 4:21pm UTC](https://forum.inductiveautomation.com/t/auto-login-based-on-ip/104173/3 "2025-03-25T16:21:50Z")

</div>

Those will always return what the gateway sees as the client's IP address, which will be the IP address of a router if there is any NAT activity going on.

However, a Vision local script can directly interrogate the java environment for client addresses and MAC IDs, among other things. See this topic for inspiration:

> [@Mobile Client MAC Address](https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037/10):
>
> In a real Vision client, you can obtain the local MAC addresses with the following script: from java.net import NetworkInterface # Get list of local mac address as strings def myMacIds(): macs = [ni.hardwareAddress for ni in NetworkInterface.getNetworkInterfaces() if ni.hardwareAddress] return [":".join(["%02x" % (b & 0xff) for b in mac]) for mac in macs] Also, again in a real Vision client, you can obtain the outbound network interface and the corresponding local IP address the clien…
