function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mahesh chandramahesh chandra 

Refresh Token is getting expired though "Refresh token is valid until revoked" is selected in App OAuth policies

In the connected App OAuth policies, I have selected "Refresh token is valid until revoked" in Refresh Token Policy.
But some times the refresh token gets expired and I get { [invalid_grant: expired access/refresh token] name: 'invalid_grant' } error. After getting a new refresh token, it works fine.
Ideally the refresh token should be valid for lifetime or until revoked.
Can someone help me with the reason behind this. 
NagendraNagendra (Salesforce Developers) 
Hi Mahesh,

An application may be listed more than once. Each time you grant access to an application, it obtains a new access token. Requests for refresh tokens increase the Use Count displayed for the application. You must grant access to your Salesforce data from each device that you use, for example, from both a laptop and a desktop computer. The default limit is five access tokens for each application. Newer applications (using the OAuth 2.0 protocol) are automatically approved for additional devices after you've granted access once. OAuth 2.0 applications can be listed more than once. Each row in the table represents a unique grant, so if an application requests multiple tokens with different scopes, you’ll see the same application multiple times.

Even if the connected app tried and failed to access your information because it could not login, the Use Count, and Last Used fields are still updated.

For more information with similar discussion please check below thread from stack exchange community which might give you a better understanding. Please mark this as solved if the information helps.

Regards,
Nagendra.