Shopify get session token using App Bridge utilities

    <script src="https://unpkg.com/@shopify/app-bridge"></script>
    <script src="https://unpkg.com/@shopify/app-bridge-utils"></script>
    <script>
        var AppBridge = window['app-bridge'];
        var AppBridgeUtils = window['app-bridge-utils'];
        var createApp = AppBridge.createApp;

        const app = createApp({
            apiKey: 'Your app API Key',
            shopOrigin: 'Shop Origin e.g. myshop.myshopify.com'
        });

        AppBridgeUtils.getSessionToken(app).then(function (result) {
            console.log(result);
        });
    </script>

Leave a Reply

Your email address will not be published. Required fields are marked *