
I try the below code but it works for the logged user but returns null for the guest users:
I also try with a callout but it returns ip of salesforce server@AuraEnabled
public static String GetUserIPAddress() {
string ReturnValue = Auth.SessionManagement.getCurrentSession().get('SourceIp');
2 answers
Hi,Greetings to you!You can use https://www.trackip.net/ip?json API to capture IP Address.Please refer to the below links which might help you further with the above requirement.https://developer.salesforce.com/forums/?id=9060G0000005Pc1QAEI hope it helps you.Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean. Thanks and Regards,
Khan Anas