Javascript oauth2 client (support server flow and client flow)