0

I am wondering if there is any out-of-the-box functionality to make a Session for a specific User using Apex code.

What I mean is this: I would create an Apex method, pass a UserID as a parameter, inside this method create an active session for the UserID and return a valid and active SessionID.

I need this method to avoid SOAP login() method and/or Connected App.

Thanks

  • You can't create a Session without authenticating in some way or another, but it doesn't have to be by calling login(). What is your ultimate goal? – David Reed May 2 at 13:30
  • @DavidReed Basically I want to expose an Apex REST method and when the external system calls it, I want to return a bunch of data and also a valid SessionID in order to avoid a further call to obtain it. Thanks! – vt89 May 2 at 13:54
  • Your remote system has to have a session Id to call the method anyway, unless you're exposing it to the unauthenticated world via a Site - which would be a terrible idea. – David Reed May 2 at 14:06
  • @DavidReed Yes, the external system uses a Connected App in order to call this Apex REST method. The SessionID I would generate in this Apex method is related to another user. – vt89 May 2 at 14:27
  • Would you please edit your question to give a more complete description of your use case? – David Reed May 2 at 14:46

Your Answer

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

Browse other questions tagged or ask your own question.