Added support for auto refresh of tokens.