You need to sign in to do that
Don't have an account?

Sometimes Refresh token expired while retrieving new access token.
Hi,
I'm receiving refresh token expired/invalid error while retrieving the new access token. This issue is occurring sometimes (as per what I've noticed it is occurring when no action is taken for last 1 day or more.) otherwise it works.
Please suggest me to solve this issue.
Below is code sample for retrieving the new access token using existing refresh token.
I'm receiving refresh token expired/invalid error while retrieving the new access token. This issue is occurring sometimes (as per what I've noticed it is occurring when no action is taken for last 1 day or more.) otherwise it works.
Please suggest me to solve this issue.
Below is code sample for retrieving the new access token using existing refresh token.
string grant_type = "refresh_token"; string data = "client_id={0}&refresh_token={1}&grant_type={2}&granularity={3}"; HttpWebRequest request = HttpWebRequest.Create(_loginUrl) as HttpWebRequest; string result = string.Empty; string param = string.Format(data, _clientId, refreshToken, grant_type, "best"); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ProtocolVersion = HttpVersion.Version11; var bs = System.Text.Encoding.UTF8.GetBytes(param); using (Stream reqStream = request.GetRequestStream()) { reqStream.Write(bs, 0, bs.Length); } using (WebResponse response = request.GetResponse()) { using (var sr = new StreamReader(response.GetResponseStream())) { result = sr.ReadToEnd(); sr.Close(); } } if (!string.IsNullOrEmpty(result)) { var jsonSerializer = new JavaScriptSerializer(); var tokenData = jsonSerializer.Deserialize<SalesForceAccessModel>(result); return tokenData.Access_Token; }


I was using 2 systems and one is making calls with wrong client Id and screte keys. Its fixed by using correct credentials.