Refactored code to use the new OAuthService