Implement API authentication.