Calling REST API from Agent using OAuth2

Is there a complete sample of calling a 3rd-party REST API from the Agent when that API requires OAuth2? In this situation, what grant type should be used?