public void example5(AccessToken token) { // Check if the token is expired. If expired it is refreshed. if (token.expired()) { // Callbacks token.refresh( res -> { if (res.succeeded()) { // success } else { // error handling... } }); } }