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
Mohan Krishnan 1Mohan Krishnan 1 

Does the refresh token and access token gets revoked when i change the redirect uri associated with my connected app?

As soon as i change my redirect uri, i am getting an error response for REST API calls stating expired access/refresh token!!
NagendraNagendra (Salesforce Developers) 
Hi Mohan,

They will expire based on your session settings in Salesforce.For Username-Password flow, you will likely need to authenticate the user again to get a new access_token.

Salesforce doesn't make this easy because there are two different places to change the settings for your connected app that affect different settings! (through Create Apps and Manage Apps). The likely cause of the issue is the setting for "Require users to log in". The proper setting for this to be able to use a refresh_token properly is "The first time they use this application".

Currently, this setting can be accessed by getting to the "setup" menu and finding "Manage Apps" in the left-hand nav. After you log in click on your username in the upper right and select "Setup". On the resulting page, in the left-hand nav, select "Manage Apps" > "Connected Apps". In the list of connected apps, select the "Edit" link for the app in question.

On the Connected App Edit page, under the OAuth Policies section, make sure you have "The first time they use this application" selected.

This will allow you to actually use a refresh_token to refresh the access_token to make authenticated requests.

For more information check with this article: Please let us know if this helps.

Regards,
Nagendra.