登录SAP Commerce Cloud的Spartacus Storefront报错:
Failed to load resource: the server responded with a status of 401 ()
unauthorized.handler.ts:25 There’s a problem with the “Oauth client” configuration. You must configure a matching Oauth client in the backend and Spartacus.
报错位置:
问题出在HTTP post请求传递给Commerce Cloud的参数:
原因是我之前处于测试目的,在b2c.feature.ts文件里修改了这个配置里的client_id和client_secret:
export const b2cFeature: FeatureEnvironment = {
imports: [
B2cStorefrontModule.withConfig({
authentication: {
client_id: 'Jerry',
client_secret: 'Jerry'
},
context: {
urlParameters: ['baseSite', 'language', 'currency'],
baseSite: [
'electronics-spa',
'electronics',
'apparel-de',
'apparel-uk',
'apparel-uk-spa',
],
},
cart: {
selectiveCart: {
enabled: true,
},
},
}),
],
};
reset修改之后问题消失:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":