• Created an android_hybrid Mobile app with Mobile SKD version 2.1
  • Added the remoteAccessConsumerKey at bootconfig.json as per my
  • Connected App Update the oauthscope as "oauthScopes": ["api refresh_token"]
  • Ran it and connected successfully
  • Kept aside for around 3-4 hours so that app gets idle
  • Can't access salesforce

Below is my bootconfig.json

    "remoteAccessConsumerKey": "my_Consumer_Key",
    "oauthRedirectURI": "sfdc://success",
    "oauthScopes": ["api refresh_token"],
    "isLocal": true,
    "startPage": "index.html",
    "errorPage": "error.html",
    "shouldAuthenticate": true,
    "attemptOfflineLoad": false,
    "androidPushNotificationClientId": ""

Is there anything to do additionally for refresh_token get works which I have missed? I found several related posts on SFSE but none of them answering mine.

If the user keeping as logged in is up to the developer but not handle by the SDK please can someone point where to look at and how to come up with it?

2 Answers 2


It's an bug in v2.1 in the line 336 forcetkRefresh of cordova.force.js, it's calling wrong error function. It should be fail instead of error. This has been fixed in v2.2


Seems silly, but check the settings for the mobile app in the org itself. I'm not sure if something got changed with a release (seems unlikely) but I was testing some code recently that hadn't been used in a while, and the refresh kept failing saying the token was invalid. Turns out the refresh token settings had been set to a one-time-use only hence the one I had stored wasn't working.

  • As far as I know I checked that as well @LaceySnr. It's Refresh Token Policy: Refresh token is valid until revoked in my case. What is the SDK version you have used?
    – highfive
    Jul 4, 2014 at 7:46

You must log in to answer this question.

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