admin-extension-sdk icon indicating copy to clipboard operation
admin-extension-sdk copied to clipboard

Directly call app backend

Open bilobait-lohrmann opened this issue 1 year ago • 3 comments

Right now it is only possible to call the app backend via action buttons. Is it possible to call the app backend in a secure way as it is for the client side (https://github.com/shopware/shopware/discussions/3191)?

bilobait-lohrmann avatar Oct 17 '23 11:10 bilobait-lohrmann

Sorry that this went unnoticed for quiet some time. We'll check this ASAP and get back to you.

seggewiss avatar Feb 12 '24 06:02 seggewiss

Hey @bilobait-lohrmann :)

I have a solution for you for this problem. If this fullfills your needs I would also write a documentation for this in the SDK. How it is working:

Your server delivers the html file for the iFrame. Every rendered iFrame has added the shop-id as a query parameter. You can get the token for this shop the same way as in the action buttons. Then you add your token inline into the HTML file as a global window variable and this token can then be used directly inside your JS code. A real life example can be found here: https://github.com/FriendsOfShopware/FroshAppWebDav/blob/main/src/handler.ts#L66

If this approach works for you then let me know and I would write a more detailed documentation for this 👍

jleifeld avatar Mar 06 '24 13:03 jleifeld

Hi @jleifeld

sounds great. thank in advance for the documentation

bilobait-lohrmann avatar Mar 07 '24 11:03 bilobait-lohrmann