BigCommerce Hello World应用-在商店中使用应用

时间:2019-03-07 07:18:43

标签: javascript jwt bigcommerce

我成功安装了Hello World app

我正在尝试在店面中使用该应用程序。 按照说明,我将提供的代码添加到脚本管理器中:

<script>
var appClientId = "**BC_CLIENT_ID**"; // TODO: Fill this in with your app's client ID.
var storeHash = "**TEST_STORE_HASH**"; // TODO: Fill this in wit the test store's store hash (found in base url before the `store-` part)
var appUrl = "**APP_URL**"; // TODO: Replace this with the URL to your app.

// Get the JWT token from the BC server signed first.
$.get('/customer/current.jwt?app_client_id=' + appClientId, function(jwtToken) {
    // Now that we have the JWT token, use it to get the recent purchases block.
    $.get(appUrl + '/storefront/' + storeHash + '/customers/' + jwtToken + '/recently_purchased.html', function(htmlContent) {
        $('#recent_purchases_block').html(htmlContent, true);
    });
});
</script>

我首先遇到了“ Uncaught ReferenceError:未定义$”错误,我解决了该错误,包括jquery-3.3.1。

但是,随后我的GET请求出现404错误。我为 APP_URL 尝试了其他值,但仍然收到此错误。 这是GET请求: https://www.marineff.com/rebates/load/storefront/STORE_HASH/customers/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJjdXN0b21lciI6eyJpZCI6MSwiZW1haWwiOiJqam9yaW9AaG90bWFpbC5jb20iLCJncm91cF9pZCI6IjAifSwiaXNzIjoiYmMvYXBwcyIsInN1YiI6Imt6N3Nma20yZHgiLCJpYXQiOjE1NTE5NDI5NTEsImV4cCI6MTU1MTk0Mzg1MSwidmVyc2lvbiI6MSwiYXVkIjoiNGZocWNvOTBha21qMzI5Z2lmMXY4dzFqdzRqN3FzZyIsImFwcGxpY2F0aW9uX2lkIjoiNGZocWNvOTBha21qMzI5Z2lmMXY4dzFqdzRqN3FzZyIsInN0b3JlX2hhc2giOiJrejdzZmttMmR4Iiwib3BlcmF0aW9uIjoiY3VycmVudF9jdXN0b21lciJ9.i7mguILu_jGue9nO5wZbtG8IhXqFkKuY71fAEsZTe27Tyxfjm4SAhUZUUxNvTbVhADP4Qm9kqY6BjU7I-SDgWA/recently_purchased.html

有什么主意吗? 谢谢

0 个答案:

没有答案