Get info about auth origin

You could do that, or you could store the token expiration and then periodically check your database for tokens that are near expiration and generate a new one before they expire so that way you should not get an unauthorized request in the first place.

It’s also worth being aware that if the refresh process fails it likely means that the user has disconnected their account from your app, so you would need to send them through the login process again if they return.