How to Refresh JWT Token with Custom Auth

Hi, I want to authenticate external api with JWT, I using custom auth to generate token and save in a variable, but how to refresh token after it is expired?