src/ShopifyApp/Traits/AuthControllerTrait.php
public function authenticate(AuthShop $request)
    {
        // Get the validated data
        $validated = $request->validated();
        $shopDomain = ShopifyApp::sanitizeShopDomain($validated['shop']);
        $shop = ShopifyApp::shop($shopDomain);

        // Start the process
        $auth = new AuthShopHandler($shop);
        $session = new ShopSession($shop);

        // Check if we have a code
        if (!$request->has('code')) {
            // Handle a request without a code, do a fullpage redirect
            // Check if they have offline access, if they do not, this is most likely an install
            // If they do, fallback to using configured grant mode
            $authUrl = $auth->buildAuthUrl(
                $shop->hasOfflineAccess() ? Config::get('shopify-app.api_grant_mode') : ShopSession::GRANT_OFFLINE
            );

            return View::make('shopify-app::auth.fullpage_redirect', compact('authUrl', 'shopDomain'));
        }

        // We have a good code, get the access details
        $access = $auth->getAccess($validated['code']);

        // Save the session
        $session->setDomain($shopDomain);
        $session->setAccess($access);

        // Do post processing and dispatch the jobs
        $auth->postProcess();
        $auth->dispatchJobs($session);

        // Go to homepage of app or the return_to
        return $this->returnTo();
    }
public function authenticate(AuthShop $request)
    {
        // Get the validated data
        $validated = $request->validated();
        $shopDomain = ShopifyApp::sanitizeShopDomain($validated['shop']);
        $shop = ShopifyApp::shop($shopDomain);

        // Start the process
        $auth = new AuthShopHandler($shop);
        $session = new ShopSession($shop);

        // Check if we have a code
        if (!$request->has('code')) {
            // Handle a request without a code, do a fullpage redirect
            // Check if they have offline access, if they do not, this is most likely an install
            // If they do, fallback to using configured grant mode
            $authUrl = $auth->buildAuthUrl(
                $shop->hasOfflineAccess() ? Config::get('shopify-app.api_grant_mode') : ShopSession::GRANT_OFFLINE
            );

            return View::make('shopify-app::auth.fullpage_redirect', compact('authUrl', 'shopDomain'));
        }

        // We have a good code, get the access details
        $access = $auth->getAccess($validated['code']);

        // Save the session
        $session->setDomain($shopDomain);
        $session->setAccess($access);

        // Do post processing and dispatch the jobs
        $auth->postProcess();
        $auth->dispatchJobs($session);

        // Go to homepage of app or the return_to
        return $this->returnTo();
    }
Authenticating a shop.

@param \OhMyBrew\ShopifyApp\Requests\AuthShop $request

@return \Illuminate\View\View|\Illuminate\Http\RedirectResponse