rewrite coinlib and add refresh token support