Loading
Prepare for Email to Become the Default Login ExperienceRead More
Get Started with B2C Commerce
Create a SLAS Secret Key for SFRA Storefronts

Create a SLAS Secret Key for SFRA Storefronts

SLAS is Salesforce B2C Commerce’s identity and token service for access to headless B2C Commerce APIs. For SFRA stores, create an external credential to store the shared secret key that SLAS uses to decrypt tokens sent from B2C Commerce.

We recommend that you create and save a new secret key every 90 days.

  1. In your Salesforce org, at the top of the page, click Setupand select Setup.
  2. In the Quick Find box, enter and select Named Credentials.
  3. On the External Credentials tab, click New.
    1. For the Label and Name, enter SFRA Shopper Agent Secret Key as the label and sfra_shopper_agent_secret_key as the name.
    2. Under Authentication Protocol, select Custom.
    3. Click Save.
      New SFRA secret key external credential

    The page for the new named credential opens with more sections.

  4. Generate a secret key.
    1. Open a terminal window, and generate a shared secret key by entering the command run command openssl rand -base64 32.
    2. Copy the output.
      You specify this key when you add a principal tied to your named credential.
  5. Return to the named credential page, and under Principals, click New.
    1. In Parameter Name, enter SharedSecretKeys. Accept the default values for the other fields.
    2. Add an authentication parameter.
    3. Enter SharedKey as the name.
    4. In Value, paste the secret key.
    5. Save your changes.
      New SFRA secret key principal
  6. For SFRA stores, add the secret key to your Service Credentials in B2C Commerce.
    1. In Business Manager, click App Launcher App Launcher, and then select Administration | Operations | Services | Credentials.
    2. Click New.
    3. Enter sfra_agent_secret_key as the name.
    4. In the password field, paste the secret key.
    5. Click Apply.
      New SFRA Business Manager secret key credential
    6. In the Profiles tab, click New.
    7. Add a profile with the name sfra_agent_secret_key.
    8. Click Apply.
      New SFRA Business Manager secret key profile
    9. In the Services tab, click New.
    10. Add a service with the name sfra_agent_secret_key.
    11. In the Type dropdown, select Generic.
    12. In the Profile and Credentials dropdown, select sfra_agent_secret_key.
    13. Click Apply.
      New SFRA Business Manager secret key service
  7. Update the Agent script in Agentforce Builder. Find the SFRA storefront settings, and set useSfraApi to true, and set sfraNamedCredential to the name of the agent.
    1. Select the agent, then select Agent Settings.
    2. Select Agent Script mode, and find the SFRA storefront (optional) code block.
    3. Set useSfraApi to true, and sfraNamedCredential to the name of the agent. Example:
    # SFRA storefront (optional).
    When useSfraApi is truthy, cart and # product actions call SFRA; otherwise they call SCAPI directly.     
    useSfraApi: string = "true"           
    label: "Use SFRA API"        
    sfraNamedCredential: string = "sframystorefront_NC"
    label: "sfraNamedCredential"
    description: "SFRA named credential."
 
Loading
Salesforce Help | Article