When Android app communicate with server via http, sometimes you need an AccessToken and a RefreshToken.
After you login, you got an AccessToken and a RefreshToken, Then you can make your common request with AccessToken,
If server gives you a response with code 401(UNAUTHORIZED), That means your AccessToken can not be used any more, that may caused by another user login with your account, or AccessToken expired.
Then you should retrieve a new AccessToken with you RefreshToken.
Here shows the code of refresh token on OkHttpClient via its Interceptor mechanism.
Then add this interceptor to your OkHttpClient.