Shopware - Not able to show my page in My apps

I created Shopware App. I wanted to show my app in Iframe. But always showing „Whoops! You’ve moved too fast and lost orientation.“

This is my manifest.xml

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/platform/master/src/Core/Framework/App/Manifest/Schema/manifest-1.0.xsd">
    <meta>
        <name>AppTemplate</name>
        <label>TwengApp</label>
        <label lang="de-DE">TwengApp</label>
        <description>Twenga Example App - Do not use in production</description>
        <description lang="de-DE">Twenga Beispiel App - Nicht im Produktivbetrieb verwenden</description>
        <author>Twenga</author>
        <copyright>(c) by Twenga</copyright>
        <version>1.2.3</version>
        <license>MIT</license>
    </meta>

    <setup>
        <registrationUrl>http://apptemplate.dev.localhost/register</registrationUrl> <!-- replace local url with real one -->
        <secret>01f17b06402f0a24e6d2b084a6d18a87</secret>
    </setup>

    <permissions>
        <read>product</read>
        <read>sales_channel</read>
    </permissions>

     <admin>
        <module name="home" source="http://apptemplate.dev.localhost/iframe/home">
            <label>Home</label>
            <label lang="de-DE">Home</label>
        </module>
    </admin>

</manifest>

And i’m using Symfony for my app, and this is my controller inside the app.

<?php

namespace App\Controller;

use App\Shop\ShopRepository;
use Shopware\AppBundle\Client\ClientFactoryInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class HomeController extends AbstractController
{
    private ShopRepository $shopRepository;

    public function __construct(
        ShopRepository $shopRepository
    ) {
        $this->shopRepository = $shopRepository;
        $this->clientFactory = $clientFactory;
    }

    /**
     * Home Controller
     */
    #[Route('/iframe/home', name: 'app_home')]
    public function index(Request $request): Response
    {
        return $this->sign([
            'actionType' => 'openNewTab',
            'payload' => ["redirectUrl"=>"http://google.com"],
        ], $request->get('shop-id'));
    }

    private function sign(array $content, string $shopId): JsonResponse
    {
        $response = new JsonResponse($content);

        $shop = $this->shopRepository->getShopFromId($shopId);

        $hmac = \hash_hmac('sha256', $response->getContent(), $shop->getShopSecret());
        $response->headers->set('shopware-app-signature', $hmac);

        return $response;
    }
}

And this is the error

And if i want to show html instead of json content in my iframe, what can i do for this ?

Please HELP !!!

Thank you

1 Like