Get info about auth origin

Aaaah I see, so to be always sure I get a valid access token I could do something like this:
Save the tokens on DB
Make a request to twitch api
If request returns unauthorized I get the new tokens and retry the request

Is it correct or do I need some other steps?