public function authRequest(Request $request)
    {
        // Get the request URI
        $uri = $request->getUri();

        if ($this->isAuthableRequest((string) $uri)) {
            if ($this->isRestRequest((string) $uri)) {
                // Checks for REST
                if ($this->private && ($this->apiKey === null || $this->apiPassword === null)) {
                    // Key and password are required for private API calls
                    throw new Exception('API key and password required for private Shopify REST calls');
                }

                // Private: Add auth for REST calls
                if ($this->private) {
                    // Add the basic auth header
                    return $request->withHeader(
                        'Authorization',
                        'Basic '.base64_encode("{$this->apiKey}:{$this->apiPassword}")
                    );
                }

                // Public: Add the token header
                return $request->withHeader(
                    'X-Shopify-Access-Token',
                    $this->accessToken
                );
            } else {
                // Checks for Graph
                if ($this->private && ($this->apiPassword === null && $this->accessToken === null)) {
                    // Private apps need password for use as access token
                    throw new Exception('API password/access token required for private Shopify GraphQL calls');
                } elseif (!$this->private && $this->accessToken === null) {
                    // Need access token for public calls
                    throw new Exception('Access token required for public Shopify GraphQL calls');
                }

                // Public/Private: Add the token header
                return $request->withHeader(
                    'X-Shopify-Access-Token',
                    $this->apiPassword ?? $this->accessToken
                );
            }
        }

        return $request;
    }
public function authRequest(Request $request)
    {
        // Get the request URI
        $uri = $request->getUri();

        if ($this->isAuthableRequest((string) $uri)) {
            if ($this->isRestRequest((string) $uri)) {
                // Checks for REST
                if ($this->private && ($this->apiKey === null || $this->apiPassword === null)) {
                    // Key and password are required for private API calls
                    throw new Exception('API key and password required for private Shopify REST calls');
                }

                // Private: Add auth for REST calls
                if ($this->private) {
                    // Add the basic auth header
                    return $request->withHeader(
                        'Authorization',
                        'Basic '.base64_encode("{$this->apiKey}:{$this->apiPassword}")
                    );
                }

                // Public: Add the token header
                return $request->withHeader(
                    'X-Shopify-Access-Token',
                    $this->accessToken
                );
            } else {
                // Checks for Graph
                if ($this->private && ($this->apiPassword === null && $this->accessToken === null)) {
                    // Private apps need password for use as access token
                    throw new Exception('API password/access token required for private Shopify GraphQL calls');
                } elseif (!$this->private && $this->accessToken === null) {
                    // Need access token for public calls
                    throw new Exception('Access token required for public Shopify GraphQL calls');
                }

                // Public/Private: Add the token header
                return $request->withHeader(
                    'X-Shopify-Access-Token',
                    $this->apiPassword ?? $this->accessToken
                );
            }
        }

        return $request;
    }
public function authRequest ( Request $ request ) { // Get the request URI $ uri = $ request -> getUri ( ) ; if ( $ this -> isAuthableRequest ( ( string ) $ uri ) ) { if ( $ this -> isRestRequest ( ( string ) $ uri ) ) { // Checks for REST if ( $ this -> private && ( $ this -> apiKey === null || $ this -> apiPassword === null ) ) { // Key and password are required for private API calls throw new Exception ( 'API key and password required for private Shopify REST calls' ) ; } // Private: Add auth for REST calls if ( $ this -> private ) { // Add the basic auth header return $ request -> withHeader ( 'Authorization' , 'Basic ' . base64_encode ( "{$this->apiKey}:{$this->apiPassword}" ) ) ; } // Public: Add the token header return $ request -> withHeader ( 'X-Shopify-Access-Token' , $ this -> accessToken ) ; } else { // Checks for Graph if ( $ this -> private && ( $ this -> apiPassword === null && $ this -> accessToken === null ) ) { // Private apps need password for use as access token throw new Exception ( 'API password/access token required for private Shopify GraphQL calls' ) ; } elseif ( ! $ this -> private && $ this -> accessToken === null ) { // Need access token for public calls throw new Exception ( 'Access token required for public Shopify GraphQL calls' ) ; } // Public/Private: Add the token header return $ request -> withHeader ( 'X-Shopify-Access-Token' , $ this -> apiPassword ?? $ this -> accessToken ) ; } } return $ request ; }
Ensures we have the proper request for private and public calls.
Also modifies issues with redirects.

@param Request $request

@return void
Ensures we have the proper request for private and public calls . Also modifies issues with redirects .