rewrite coinlib and add refresh_token support