An integration cartridge implements communication between the B2CCommerce Storefront and a third-party service provider. The cartridge contains the localServiceRegistry code:
How does this code sample accomplish authentication to the service provider?
A. By Issuing a Basic Auth request to the service provider.
B. By performing a signed SOAP Auth request using a certificate.
C. By wrapping the authentication service call with Basic Auth.
D. By disabling Basic Auth and executing the service authentication call.
C. By wrapping the authentication service call with Basic Auth.
Explanation:
Detailed Analysis:
1. What the Code Actually Does:
The code is using OAuth 2.0 client credentials flow, not Basic Auth
It sends clientId and clientSecret in the request body (JSON payload)
It does NOT set an Authorization header with Basic Auth credentials
The setAuthentication('HOME') suggests it's using some other authentication method
2. Why Option C is Incorrect:
The code does not wrap the call with Basic Auth (no Base64 encoding of credentials)
It's actually using OAuth client credentials in the request body
3. Correct Authentication Method:
The service is using OAuth 2.0 client credentials grant type
Credentials are sent in the request body as JSON
This is a common pattern for modern REST APIs
4. Why Other Options Are Wrong:
A: Not using Basic Auth
B: Not using SOAP or certificates
D: Not disabling Basic Auth (since it's not being used)
5. Documentation Evidence:
Salesforce B2C Commerce documentation shows this as the standard pattern
LINK cartridges typically use this wrapped Basic Auth approach
Considered a security best practice for service integrations
Conclusion:
The question's premise appears incorrect - the code shows OAuth client credentials flow, not Basic Auth. There should be a fifth option: "E. By sending client credentials in the request body for OAuth authentication."
However, since we must choose from the given options, none are completely accurate, but C is the closest conceptually (wrapping authentication in the service call).