How to execute Custom Flow during refresh_token grant

How can we execute custom flow during refresh_token grant using configuration or programmatically ?