Support OAuth2 authorization for better integration with third-party apps (#752)