We are developing a managed package which includes connected app (ios native). In our subscribers org, under connected apps we can see our connected app. There is an option "Refresh token is valid until revoked" which is checked but our mobile keeps loging our customers out after a period of time.

Is there any way to make these sessions lifetime permemant ? (Users should stay logged in until they want to logout)

1 Answer 1


We also have a product using the connected app.

Do not ship connected app with managed package as you can create a one connected to authenticate multiple users. Let your app use common connected app credentials thought all app installation.

When user authorise using connected app, access token and refresh token are received after the successful auth flow.

Access token are organisation's session dependent, if any salesforce user has set the session logout time to 2 hours then you access token will expire in two hours.

To prevent logout keep track of expire time which is received with access token and refresh token. Develop a mechanism in app which could track token expiration time for logged in user. If token has crossed the expire time, request for new access token using refresh token. As it is a ios app so run a NSThread to check for token expiration periodically.

  • Is there any functionality in salesforce iOS sdk which is already doing this auto refresh token process? And second question is we already shipped connected app with our managed pack :( . Is this a bad thing ?
    – Onur Var
    Commented Sep 27, 2014 at 14:27
  • As far as i know i doesn't have in such a way which i explained you. You should ask a separate question for it. Shipping a connected app is not a bad thing. It depends on application design and customer assurance.
    – Ashwani
    Commented Sep 28, 2014 at 16:37

You must log in to answer this question.

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