function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Azzu3 ShaikAzzu3 Shaik 

How to know the logged in users Ip address

Hi All,
Is there any way to find out the logged in users ip address.Please give me some idea if any one knows it.


Thanks.
Best Answer chosen by Azzu3 Shaik
sandeep sankhlasandeep sankhla
Hi Azzu3,

String ipAddress = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

'True-Client-IP' - when the request is coming via the caching integration.

'X-Salesforce-SIP' - when the request is not via caching integration (sandbox, developer edition orgs) or via the secure url.

Cheers!!!

Please mark this as solved and best answer to make this community clean for other users.

All Answers

sandeep sankhlasandeep sankhla
Hi Azzu3,

String ipAddress = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

'True-Client-IP' - when the request is coming via the caching integration.

'X-Salesforce-SIP' - when the request is not via caching integration (sandbox, developer edition orgs) or via the secure url.

Cheers!!!

Please mark this as solved and best answer to make this community clean for other users.
This was selected as the best answer
James LoghryJames Loghry
If you can implement whatever logic you're working on into a Login Flow, you could also use the "LoginFlow_IpAddress" global variable.  For more on that, see: https://developer.salesforce.com/page/Login-Flows
Srinivasa Rao Latchu 3Srinivasa Rao Latchu 3
Hi @sandeep, can you help with code snippet  / way  I get the ipaddresss of the community user in salesforce lightnimg?