Skip to main content
Andrea Destro 님이 #Apex에 질문했습니다
Hi, is there a way to get the ip address of the connected guest user?

I try the below code but it works for the logged user but returns null for the guest users:

@AuraEnabled

public static String GetUserIPAddress() {

string ReturnValue = Auth.SessionManagement.getCurrentSession().get('SourceIp');

I also try with a callout but it returns ip of salesforce server

 
답변 2개
  1. 2018년 12월 11일 오전 8:07
    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=9060G0000005Pc1QAE

    I 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
0/9000