code: protected function getResourceAttribute($name, $resourceOwner)
      {
          // Call resource owner getter first
          $method = "get" . $name;
  
          if (is_callable(array($resourceOwner, $method))) {
              $res = $resourceOwner->$method();
              return $res;
          } else {
              $resourceArray = $resourceOwner->toArray();
              $res = $this->getValueByKey($resourceArray, $name);
              return $res;
          }
      }
docs: Gets an attribute from the resource owner
  
  @param string $name Attribute name
  @param \League\OAuth2\Client\Provider\ResourceOwnerInterface $resourceOwner Resource owner instance
  @return mixed The retrieved value