Is there an API for getting the current IP address that you can use in Apex code? I didn't see anything in UserInfo, and I don't want to use the LoginHistory object at all for this.


You should be able to query AuthSession.SourceIp. An AuthSession record with a SessionType of SubstituteUser is created when you log in as another user.

  • Danke schön! Using it in a Login Flow. – Kirill Yunussov Jan 18 '19 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.