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.


1 Answer 1


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. Jan 18, 2019 at 16:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .