0

Is there a difference between {!$Api.Session_ID} on visualforce vs UserInfo.getsessionID() in Apex. I tried to print these 2 values on Visualforce page and see that both values are different.

One issue I am facing is I have a visualforce page and javascript on it which calls a webservice method. When Page loads the value in {!$Api.Session_ID} gets printed on to page and I have set session timeout in session settings to 30 minutes. I keep calling remoting methods during these 30 minutes using SessionId but after 30 mins when i try to make webservice call using {!$Api.session_Id} I get insufficient access error.

Can someone point out how many different sessionIds can we have and how to maintain these sessionIds active so keeping one active can also keep other sessionIds active ?

Edit : My question mainly is about how to make sure if I am using apex generated session ID (first class sessionID) then how can I keep the visualforce sessionID not to expire/ timeout as this VF generted sessionID is getting timed out based on value in session time out where as my "first class" sessionId is still active as I am using it in remoting calls.

2
  • Possible duplicate: Different Session Ids in Different contexts – Daniel Ballinger Nov 27 '18 at 20:08
  • Thanks @DanielBallinger and @ sfdcfox. I have edited my question to be more specific. I have went through the link you mentioned here but I am curious about my VF generated sessionID getting timedout based on inctivity/ idle time out – sf_user Nov 28 '18 at 1:36