Authorization for Shopper APIs

Learn how to set up the Shopper Login and API Access Service (SLAS) so that you can request access tokens for Shopper APIs. (To learn how to access the Admin APIs, see Authorization for Admin APIs.)

To get you up and running as fast as possible, the instructions provided here use a web application called the SLAS Admin UI. If you require additional configuration options or are building automated setup tools, you can also use the SLAS Admin API instead of the UI.

(You must have the Account Administrator role in Account Manager to do this task. If you get stuck, ask an administrator on your team for help or contact Support.)

For each user performing the SLAS administration tasks described in this guide, follow these steps to set up their roles and filters:

  1. Log in into Account Manager.

  2. Click User from the left navigation.

  3. Click the user’s ID.

  4. Scroll down to Roles and click Add.

    Screenshot -medium

  5. Enter "slas" in the filter search box.

  6. (If you see no results, the role has likely been added already, so you can click Cancel and skip to step 9.)

  7. Select SLAS Organization Administrator.

    Screenshot -small

  8. Click Add.

  9. Look for the SLAS Shopper Admin API category with the SLAS Organization Administrator role below it.

  10. Click the filter button next to the SLAS Organization Administrator role.

    Screenshot -medium

  11. Select an organization.

  12. Select the hostnames for specific B2C Commerce instances that you want to configure. You can also select All Sandboxes instead of selecting each sandbox individually.

  13. Click Add.

    Screenshot -small

  14. Scroll down to the bottom of the page.

  15. Click Save.

(It can take up to 15 minutes for role changes to propagate and take effect.)

The easiest way to create a SLAS client is to use the SLAS Admin UI. To access the SLAS Admin UI, replace {{short-code}} in the following URL with the short code used by your B2C Commerce instances:

To learn more about Commerce Cloud short codes, see the Configuration Values guide.

Repeat these steps to create a SLAS client for each B2C Commerce instance that requires access to Shopper APIs:

  1. Log in to the SLAS Admin UI using your Account Manager credentials.

  2. From the top navigation, click Clients.

  3. Click Add Client.

    Screenshot -large

  4. Click Choose Tenant... and select a B2C Commerce instance.

    Screenshot -large

  5. Customize the client settings for your instance.

  6. To create a private client, enter a password string in the Secret field.

  7. Click Submit.

Now you can use your SLAS client to request an access token for Shopper APIs!

If you already created your SLAS clients using the SLAS Admin UI, you can skip this section and move on to Next Steps.

You can also use the SLAS Admin UI to get a SLAS admin token for making requests directly to the SLAS Admin API. The API offers additional tools and gives you access to more configuration options than the UI.

To get a SLAS admin token:

  1. Log in to the SLAS Admin UI.
  2. Click Token from the top navigation.
  3. Click Copy Admin Token to Clipboard. (The admin token will expire after 30 minutes.)

Screenshot -large

Set Environment Variables

To form your API request correctly, it helps to set some environment variables first.

If you’re not using a Unix-based operating system, you can adapt the commands for setting environment variables or manually replace the variables later in the curl command provided.

To store the admin token, replace {{clipboard_contents}} in the following command by pasting the token that you just copied:

Before running the next series of commands, replace zzte, 053, and kv7kzm78 with your realm ID, instance ID, and shortcode. To learn more about these identifiers, including how to look them up in Business Manager, see the Configuration Values guide.

The Request Body

The JSON data that you provide in the request body controls important settings for the SLAS client:

  • The channels array allows you to associate the SLAS client with one or more channels. A channel is what we call the string used to identify a particular ecommerce site.
  • The scopes array lists all the API families that the SLAS API has access to.
  • The redirectUri array allows specific URIs for redirects. Wildcard characters (*) are supported for hostnames.

In the example requests provided, we’ve populated the request body with some common settings that you can customize for your application.

Example Request: Create a Public SLAS Client

To create a public SLAS client using the SLAS Admin UI, you must set one more environment variable. Replace da422690-7800-41d1-8ee4-3ce983961078 in the following command with the client ID that you created earlier.

Now that you’ve set your environment variables, run this command to create a public SLAS client:

Since the request is for setting up a public client, no client secret is required.

Example Request: Create a Private SLAS Client

To create a private SLAS client using the SLAS Admin UI, you must set two more environment variables. Replace da422690-7800-41d1-8ee4-3ce983961078 and D*HHUrgO2%qADp2JTIUi in the following command with the client ID and client secret that you created earlier.

Now that you’ve set your environment variables, run this command to create a private SLAS client:

Now that you know how to set up SLAS clients, it’s time to make some API requests! Learn how to formulate your API requests with the last guide in the Get Started series: Base URL and Request Formation.

To learn more about using public SLAS clients and private SLAS clients to access the Shopper APIs, see the SLAS guides.

For more technical details on the capabilities of the SLAS APIs, explore the API specifications in the Reference section:

To learn how to access the Admin APIs, see Authorization for Admin APIs.