Adding workaround for the token expiry problem
(see comment inside the code)