# Get user's public IP when login

**URL:** <https://forum.keycloak.org/t/get-users-public-ip-when-login/11146>\
**Category:** Miscellanaeous\
**Created:** [September 23, 2021, 11:39am UTC](https://forum.keycloak.org/t/get-users-public-ip-when-login/11146 "2021-09-23T11:39:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhanDuy0407](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/phanduy0407/32/3147_2.png) [@PhanDuy0407](https://forum.keycloak.org/u/PhanDuy0407)\
**Post date:** [September 23, 2021, 11:39am UTC](https://forum.keycloak.org/t/get-users-public-ip-when-login/11146/1 "2021-09-23T11:39:10Z")

</div>

Hi there.  
Is there anyway to get user’s public IP when user login to Keycloak server ?

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [September 23, 2021, 2:58pm UTC](https://forum.keycloak.org/t/get-users-public-ip-when-login/11146/2 "2021-09-23T14:58:39Z")

</div>

> [@Limit login of a specific users from whitelist IP address](http://forum.keycloak.org/t/limit-login-of-a-specific-users-from-whitelist-ip-address/11089/6):
>
> If you are trying to do that in a custom Authenticator you can use the AuthenticationFlowContext. Depending if you’re using a reverse proxy the IP can come from one of the following methods: // no reverse proxy authenticationFlowContext.getHttpRequest().getRemoteAddress(); // with reverse proxy authenticationFlowContext.getHttpRequest().getHttpHeaders().getHeaderString("X-Forwarded-For");

---

<div class="post-metadata">

**Author:** ![Cyben](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/cyben/32/2547_2.png) [@Cyben](https://forum.keycloak.org/u/Cyben)\
**Post date:** [September 24, 2021, 6:30am UTC](https://forum.keycloak.org/t/get-users-public-ip-when-login/11146/3 "2021-09-24T06:30:38Z")

</div>

If you are behind a proxy, you could send the X-Forwarded-For header, I’m quite sure there is a topic about that in the documentation
