SalesforceCommerceCloud / b2c-crm-sync

... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
https://salesforcecommercecloud.github.io/b2c-crm-sync/
BSD 3-Clause "New" or "Revised" License
65 stars 45 forks source link

[BUG] ... OrderOnBehalf Access to XMLHttpRequest #264

Closed mzaklama closed 3 months ago

mzaklama commented 4 months ago

Describe the bug Access to XMLHttpRequest at 'https://staging-xxxx-xxxxxxx.demandware.net/s/izil/dw/shop/v24_1/sessions' from origin 'https://xxxxxxxxx--xxxxxx.sandbox.lightning.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

To Reproduce Steps to reproduce the behavior:

  1. Go to any Account record
  2. Click on Order On Behalf Of action
  3. Click Next in the flow
  4. Click Launch Order On Behalf Of button
  5. Nothing happens and I get the error in the console.

CORS and Trusted URLs are set up correctly in Salesforce Setup allowed_origins are set up in OCAPI Settings in BM for Shop API Global "_v" : "24.1" for the client_id that is being used

mzaklama commented 3 months ago

Issue was using an old version of the LWC

mkp4ugithub commented 3 months ago

old version of the LWC

May I know what exactly you meant when you say this?

mzaklama commented 3 months ago

LWC: b2COrderOnBehalfOf Flow: B2C Commerce: Order On Behalf Of: Contacts

We had an old version of the LWC and Flow. LWC was missing the token type in the authentication header. Flow was not sending the token type to the LWC.

When updated, it worked fine. @mkp4ugithub

mkp4ugithub commented 3 months ago

LWC: b2COrderOnBehalfOf Flow: B2C Commerce: Order On Behalf Of: Contacts

We had an old version of the LWC and Flow. LWC was missing the token type in the authentication header. Flow was not sending the token type to the LWC.

When updated, it worked fine. @mkp4ugithub

Thank you! If it is because we are missing token, I'd expect that error to show-up in the response fields in the LWC. I think ours is already pointing to the latest versions. We will check that again and update here.