You need to sign in to do that
Don't have an account?
forcetk refresh token
Hi,
I am developing Hybrid application to work offline.
I am running Account Editor Sample application. After some time when security token become expires and application calls following function of the this file cordova.force.js :
var forcetkRefresh = function (forcetkClient, success, fail) {
authenticate(function(oauthResponse) {
var oauthResponseData = oauthResponse;
if (oauthResponse.data) {
oauthResponseData = oauthResponse.data;
}
forcetkClient.setSessionToken(oauthResponseData.accessToken, null, oauthResponseData.instanceUrl);
success();
},
error);
};
And It returns error. Please help to resolve this error. App is not refreshing access_token.
I am developing Hybrid application to work offline.
I am running Account Editor Sample application. After some time when security token become expires and application calls following function of the this file cordova.force.js :
var forcetkRefresh = function (forcetkClient, success, fail) {
authenticate(function(oauthResponse) {
var oauthResponseData = oauthResponse;
if (oauthResponse.data) {
oauthResponseData = oauthResponse.data;
}
forcetkClient.setSessionToken(oauthResponseData.accessToken, null, oauthResponseData.instanceUrl);
success();
},
error);
};
And It returns error. Please help to resolve this error. App is not refreshing access_token.
Taken from "Digging Deeper into Oauth 2.0 on Force.com", your application can obtain a new access token by POSTing another request to: https://login.salesforce.com/services/oauth2/token. The payload should be of the form: grant_type=refresh_token&client_id=[your client id]&client_secret=[your client secret]&refresh_token=[the user's refresh token].
http://stackoverflow.com/questions/9499059/how-to-refresh-access-token-in-oauth-2-0-in-salesforce
https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_oauth_refresh_token_flow.htm&language=en_US
Regards,
Ashish