code: public function redirectUrlForUser(array $params)
      {
          if (!array_key_exists('state', $params)) {
              throw new \InvalidArgumentException('state parameter required');
          }
  
          if (!array_key_exists('scope', $params)) {
              throw new \InvalidArgumentException('scope parameter required');
          }
  
          $url = $this->getConfig('sandbox')
              ? 'https://auth.sandbox.ebay.com/oauth2/authorize?'
              : 'https://auth.ebay.com/oauth2/authorize?';
  
          $urlParams = [
              'client_id'     => $this->getConfig('credentials')->getAppId(),
              'redirect_uri'  => $this->getConfig('ruName'),
              'response_type' => 'code',
              'state'         => $params['state'],
              'scope'         => implode($params['scope'], ' ')
  
          ];
  
          return $url.http_build_query($urlParams, null, '&', PHP_QUERY_RFC3986);
      }
docs: @param array $params An associative array with state and scope as the keys.
  
  @return string The redirect URL.
  @throws \InvalidArgumentException.