For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
For admin block extension
https://shopify.dev/docs/apps/build/admin/actions-blocks/build-admin-block?extension=react
Is there an easy way to access the shop handle or permanent_domain? Like foo.myshopify.com?
I need to make a request to my server that contains the normal shop= context that we get from embedded app requests.
I poked around with useApi() within BlockExtension.jsx but doesn't seem to anywhere there. There does not seem to be access to window object either.
Hi - you don't need need to include the shop domain to requests to the backend through url params like that as it's not secure. The recommended approach is to use session tokens. Session tokens are automatically included when they make a fetch request to your app's url. Specifically the shop domain is available as the dest
property after decoding the session token (either using one of Shopify's libraries or manually decoding with a JWT library).
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog