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
manimmanim 

Refresh token flow

Hi,

I want to test refresh token flow using outh framework.

I want to do it something like below

 

if(response.toString().contains("access token expired")){

//SEND REQUETS FOR REFRESH TOKEN

}

How do I test this? Is there any way to manually deactivate the access token?

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
LoganLogan

yes, you can deactivate the token for that user by going into setup | Personal Information, then look at the bottom of the page under Remote Access - you'll see the api clients listed there, click revoke.  The other way to test it is to make a request with a token that is invalid (just a random string) which will raise an error, then you do the refresh flow.

 

You can see how I rescue invalid tokens and get a new one here:

 

https://github.com/henriquez/chatter-sales/blob/master/app/models/session.rb