```ruby
def self.authenticate_provider(username, key)
  provider = where(api_username: username).first
  
  return unless provider && provider.api_key

  provider
end
```