I have a few questions. I'm building native ios app that can talk with salesforce and I used sdk and samples from here

  • what is time value of our session in mobile app to be logged out ??(when user logged in , after some time it logs out automatically)

  • Does it somehow have relation with configuration in Setup >> Security Controls >> Session Timeout ?

Thanks in advance.

Update 1

Addition to @Abhinav Gupta's answer below (Thanks Abhinav Gupta), I would like to logout user if his/her session is expired or invalid. And also this is kinda offline app, is there any way to check if session is expired or invalid while we are offline ( like checking session_end_date value)

1 Answer 1


iOS SDK uses OAuth for getting tokens to communicate with salesforce orgs. Just like other OAuth setups, one needs to use refresh token flows to ensure that access tokens are still valid. This refresh token part, iOS Mobile SDK is transparently doing for you.

Yes OAuth token lifetime is related to session timeout setting in Salesforce, so changing that in Setup area should reflect back on your app. Again you mostly don't need to worry about it, as Salesforce iOS sdk takes care refresh-token flow transparently. Following is a snippet from official salesforce docs (read here)

Access tokens have a limited lifetime specified by the session timeout in Salesforce. If an application uses an expired access token, a “Session expired or invalid” error is returned. If the application is using the Web server or user-agent OAuth authentication flows, a refresh token may be provided during authorization that can be used to get a new access token. The client application obtains a new access token by sending a POST request to the token request endpoint


You must log in to answer this question.

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