Improvements for oauth2