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
Admin DNAAdmin DNA 

ip of guest user of lightning community

Hi,
I try with this solution,
https://developer.salesforce.com/forums/?id=9060G0000005Pc1QAE
but It returns the ip ogf salesforce server. I want to get ip of client guest user of a ligghtning community.
Is there a solution?
Thankyou in advance
SandhyaSandhya (Salesforce Developers) 
Hi,

Try below code
String ip = Auth.SessionManagement.getCurrentSession().get('SourceIp');

Best Regards,
Sandhya
Admin DNAAdmin DNA
Thankyou Sandhya, I also try your solution but it only works for logged user, I'm unable to retrieve ip for guest users