我已经构建了一个小程序来帮助识别具有不正确状态的Demandware中的订单,例如:(状态:新的、打开的、已完成的和发货状态:未发货、发货)。
我基本上只是使用order_search从OCAPI和比较的结果与我们的ERP。
然而,现在我想自动化一些状态的修复,这需要我使用/orders/{order_no} GET和补丁调用,但是当我这样做时,我会得到以下消息:
{ type: 'AccessWithoutUserForbiddenException',
message: 'An authenticated user is required in order to access resource.' }根据docsOAuthfororder_search使用:“通过OAUTH令牌进行身份验证。”,但是orders/{order_no}使用:“通过OAuth令牌进行身份验证。需要一个有效的用户。”
那么,成为一个有效用户的正确策略是什么呢?
发布于 2016-11-28 09:16:57
获取oAuth令牌的有效用户是Business用户。因此,请登录到Business,为您的用例创建一个新用户,并授予必要的权限。
之后,您可以执行特定的资源。
克里斯蒂安
发布于 2020-01-14 14:21:43
如果您使用account.demandware.com作为主机,那么它将抛出以下错误
{错误:未经授权的客户端“,error_description:'Client id‘
相反,您可以将主机更改为沙箱主机。再试一次。应该管用的。我也面临着同样的问题。
const key = new Buffer('business_manager_email_id' + ":" + 'business_manager_pwd' + ":" + 'client_pwd').toString("base64");
const options = {
url: 'https://<sandbox_host>/dw/oauth2/access_token?client_id=your_client_id',
method: "POST",
headers: {
'Authorization': "Basic " + key,
"Content-Type": "application/x-www-form-urlencoded",
},
body: "grant_type=urn:demandware:params:oauth:grant-type:client-id:dwsid:dwsecuretoken"
};https://stackoverflow.com/questions/40815230
复制相似问题