Is there any document or reference about the validity period of refreshtoken of Mobile SDK? I have a hybrid local app and if I let the app to be idle for a while and use back, it's failing with the log Undefind character, error is not defined in line 336 at Cordova.force.js This line is the error argument of the forcetkRefresh function. I'm unable to catch when this is expiring or what to do next.
I'm using Mobile SDK version 2.1


The refresh token may have an indefinite lifetime, persisting for an admin-configured interval or until explicitly revoked by the end-user.

Since refresh tokens may expire or be revoked by the user outside the control of the client application, the client must handle failure to obtain an access token, typically by replaying the protocol from the start.

In your connected app settings in salesforce you will find refresh token policy .Hope this helps

enter image description here

  • Thanks for the reply @Mohith, I have chosen Refresh token is valid until revoked option as the Refresh Token Policy as in above which am thinking it should valid until I explicitly revoke that. But still without a clue for me it's failing
    – highfive
    Jun 16 '14 at 18:27
  • @highfive I have observed this and it happens when salesforce servers due to some reason stop for small fraction of seconds.In UI during this time we get salesforce Internal Server error .You can visit trust.salesforce.com to figure the health of your server Instance .Also change your org to some other instance and replicate issue if it persists .Best wishes Jun 16 '14 at 18:37

As in Mohith's answer the refresh token may have an indefinite lifetime. The issue here is not regarding the validity period but in the SDK it's calling an incorrect failure function at line 336 of cordova.force.js. error should be replaced by fail. This has been fixed in v2.2

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.