Set Up API Access

Enable your PWA Kit storefront to securely access data from Shopper APIs, including products, baskets, orders, and more. The technology that authorizes this API access is called the Shopper Login and API Access Service (SLAS), which is part of the Salesforce B2C Commerce API. In addition to authorizing API requests to the B2C Commerce API, SLAS also authorizes API requests to the Open Commerce API (OCAPI).

The setup process has recently been streamlined thanks to the new SLAS Admin UI.

Complete the instructions in Authorization for Shopper APIs in the B2C Commerce API documentation to create a SLAS client. We encourage you to use a SLAS private client but depending on your use case, you could opt to use a SLAS public client instead.

If you’re planning to do a phased rollout of a PWA Kit experience, make sure to follow the instructions in the Extra Steps for Phased Rollouts of PWA Kit section of the guide.

After creating a SLAS client, return to this guide and read on.

If you are using a SLAS private client, you must set the client secret via an environment variable.

Projects generated from PWA Kit 3.5 and above will be configured to use a SLAS private client by default.

To learn more about using SLAS private clients, see Using A Slas Private Client.

If you are using a SLAS public client, skip this section and continue with updating your OCAPI settings as described in the next section.

For certain features, your PWA Kit storefront must make requests to the Open Commerce API (OCAPI) on your B2C Commerce instance.

Here’s how to update your OCAPI settings for PWA Kit:

  1. Log in to Business Manager on your B2C Commerce instance.
  2. Go to Administration > Site Development > Open Commerce API Settings.
  3. Copy this JSON:
  1. Go back to Business Manager and paste the JSON into the field.
  2. Replace the placeholder value for PLACEHOLDER_CLIENT_ID with the client ID for the public SLAS client that you created using the SLAS Admin UI.
  3. Scroll down to the bottom of the page.
  4. Click Save.

Repeat these instructions for each B2C Commerce instance that is used with PWA Kit.