List<OauthToken> invalidTokens = [Select id, user.name, accesstoken,AppName, DeleteToken From OauthToken where user.IsActive = false];
Auth.OauthTokenType deltoken = Auth.OauthTokenType.DELETE_TOKEN;
for(OauthToken invalidToken :invalidTokens){
try{
Boolean result = Auth.OauthToken.revokeToken(deltoken,invalidToken.DeleteToken);
system.debug('Result is: '+result);
}catch (Exception e){
system.debug('Exception is: '+e);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter