+ Start a Discussion
hyjhyj 

Meeting Session ID expired frequently

Hi all,

I'm using SFDC API to get Contact data from Salesforce.
My integration works well until I get a new user from my customer.
The session id of their user would get WedException "(401) Unauthorized" with raw response [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}] frequently (once per hour sometimes but per minute mostly). When retrying to login, new session id would work for next minute, and then that issue occurs again.

I'm not quite understand why its session id would be expired in so short time.
Is there any reason could cause session id expired?
Any suggestions?

Thanks,
Yinjie
NagaNaga (Salesforce Developers) 
Hi Yinjie,

I need to ask you some questions here..

Is SFServerUrl the same Salesforce pod/server that the Session Id was issued to? For example If the Session Id came from NA2 then it would be invalid on na17.
How did you create the Session Id? If you used OAuth, what scopes did you request?
Is the Session Id coming out of the cookie valid?
Has something else using the same Session Id called logout and invalidated the session?

Best Regards
Naga Kiran
hyjhyj
Hi Naga,

I'm just using SOAP API to login, and my integration could work.
But the Session ID becomes expired so quickly.
I could be sure that it is only me testing on this user.
Could you help me to find out why the Session ID becomes expired?

Thanks
Andries.NeyensAndries.Neyens
Check out:

Setup -> Administer -> Security Controls -> Session Settings.

Maybe it will shed some light?
hyjhyj
HI Andries,

Thanks for your suggestion. And I had a try just now.
I could find only Timeout Value setting which seems to be having an impact. But it is 2 hours now.
Could you help me to point out some setting options which could impact the expired time interval?

Thanks