Skip to content

Commit 1c542ba

Browse files
committed
skill nits
1 parent e76d6a5 commit 1c542ba

File tree

2 files changed

+77
-4
lines changed
  • plugins

2 files changed

+77
-4
lines changed

plugins/b2c-cli/skills/b2c-slas/SKILL.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ description: Using the b2c CLI for SLAS (Shopper Login and API Access Service) c
77

88
Use the `b2c` CLI plugin to manage SLAS (Shopper Login and API Access Service) API clients and credentials.
99

10+
## When to Use This Skill
11+
12+
Common scenarios requiring SLAS client management:
13+
14+
- **Testing Custom APIs**: Create a client with custom scopes (e.g., `c_loyalty`) to test your Custom API endpoints
15+
- **PWA/Headless Development**: Configure clients for composable storefronts
16+
- **Integration Testing**: Create dedicated test clients with specific scope sets
17+
1018
## Examples
1119

1220
### List SLAS Clients
@@ -47,6 +55,44 @@ b2c slas client create --tenant-id abcd_123 --channels RefArch --default-scopes
4755

4856
Note: By default, the tenant is automatically created if it doesn't exist.
4957

58+
### Create Client for Custom API Testing
59+
60+
When testing a Custom API that requires custom scopes:
61+
62+
```bash
63+
# Create a private client with custom scope for testing
64+
# Replace c_my_scope with your API's custom scope from schema.yaml
65+
b2c slas client create \
66+
--tenant-id zzpq_013 \
67+
--channels RefArch \
68+
--default-scopes \
69+
--scopes "c_my_scope" \
70+
--redirect-uri http://localhost:3000/callback \
71+
--json
72+
73+
# Output includes client_id and client_secret - save these for token requests
74+
```
75+
76+
**Important:** The custom scope in your SLAS client must match the scope defined in your Custom API's `schema.yaml` security section.
77+
78+
### Get a Token for Testing
79+
80+
After creating a SLAS client, obtain a token for API testing:
81+
82+
```bash
83+
# Set credentials from client creation output
84+
SHORTCODE="zzpq"
85+
ORG="f_ecom_zzpq_013"
86+
CLIENT_ID="your-client-id"
87+
CLIENT_SECRET="your-client-secret"
88+
SITE="RefArch"
89+
90+
# Get access token
91+
curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/$ORG/oauth2/token" \
92+
-u "$CLIENT_ID:$CLIENT_SECRET" \
93+
-d "grant_type=client_credentials&channel_id=$SITE"
94+
```
95+
5096
### Update SLAS Client
5197

5298
```bash
@@ -69,3 +115,8 @@ The tenant ID can be set via environment variable:
69115
### More Commands
70116

71117
See `b2c slas --help` for a full list of available commands and options in the `slas` topic.
118+
119+
## Related Skills
120+
121+
- `b2c:b2c-custom-api-development` - Creating Custom APIs that require SLAS authentication
122+
- `b2c-cli:b2c-scapi-custom` - Checking Custom API registration status

plugins/b2c/skills/b2c-custom-api-development/SKILL.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,11 @@ When endpoints return 404 or fail to register:
269269

270270
### For Shopper APIs (ShopperToken)
271271

272-
1. Configure custom scope in SLAS Admin UI
273-
2. Obtain token via Shopper Login (SLAS)
274-
3. Include `siteId` in requests
272+
1. **Create or update a SLAS client** with your custom scope(s)
273+
- Use `b2c slas client create --default-scopes --scopes "c_my_scope"` to create a test client
274+
- See `b2c-cli:b2c-slas` skill for full client management options
275+
2. Obtain token via Shopper Login (SLAS) using the client credentials
276+
3. Include `siteId` in all requests
275277

276278
### For Admin APIs (AmOAuth2)
277279

@@ -342,6 +344,25 @@ See the `b2c-cli:b2c-scapi-custom` skill for more status options.
342344

343345
Test your Custom API endpoints using curl after deployment.
344346

347+
### Prerequisites for Testing
348+
349+
Before testing a Shopper API with custom scopes, ensure you have a SLAS client configured with those scopes:
350+
351+
```bash
352+
# Create a test client with your custom scope (replace c_my_scope with your scope)
353+
b2c slas client create \
354+
--tenant-id zzpq_013 \
355+
--channels RefArch \
356+
--default-scopes \
357+
--scopes "c_my_scope" \
358+
--redirect-uri http://localhost:3000/callback \
359+
--json
360+
361+
# Save the client_id and client_secret from the output
362+
```
363+
364+
See `b2c-cli:b2c-slas` skill for more options.
365+
345366
### Get a Shopper Token (Private Client)
346367

347368
Using a private SLAS client with client credentials grant:
@@ -373,7 +394,7 @@ curl -s "https://$SHORTCODE.api.commercecloud.salesforce.com/custom/my-api/v1/or
373394
### Testing Tips
374395

375396
- Use `b2c slas client list` to find existing SLAS clients
376-
- Use `b2c slas client create --scopes "c_my_scope,sfcc.shopper-*"` to create a test client
397+
- Use `b2c slas client create --default-scopes --scopes "c_my_scope"` to create a test client
377398
- Check logs with `b2c webdav get` from the `logs` root if requests fail
378399

379400
## HTTP Methods Supported
@@ -463,6 +484,7 @@ See `b2c:b2c-webservices` skill for complete schema documentation, or run `b2c d
463484

464485
- `b2c-cli:b2c-code` - Deploying cartridges and activating code versions
465486
- `b2c-cli:b2c-scapi-custom` - Checking Custom API registration status
487+
- `b2c-cli:b2c-slas` - Creating SLAS clients for testing Shopper APIs with custom scopes
466488
- `b2c:b2c-webservices` - Service configuration, HTTP/FTP/SOAP clients, services.xml format
467489
- `b2c-cli:b2c-job` - Running jobs and importing site archives
468490

0 commit comments

Comments
 (0)