@@ -49,6 +49,103 @@ For complete setup instructions, see the [Authentication Guide](/guide/authentic
4949
5050---
5151
52+ ## b2c slas token
53+
54+ Get a SLAS shopper access token for testing APIs.
55+
56+ ### Usage
57+
58+ ``` bash
59+ b2c slas token --tenant-id < TENANT_ID> --site-id < SITE_ID>
60+ ```
61+
62+ ### Flags
63+
64+ | Flag | Environment Variable | Description | Required |
65+ | ------| ---------------------| -------------| ----------|
66+ | ` --tenant-id ` | ` SFCC_TENANT_ID ` | SLAS tenant ID (organization ID) | Yes |
67+ | ` --site-id ` | ` SFCC_SITE_ID ` | Site/channel ID | Yes* |
68+ | ` --slas-client-id ` | ` SFCC_SLAS_CLIENT_ID ` | SLAS client ID (auto-discovered if omitted) | No |
69+ | ` --slas-client-secret ` | ` SFCC_SLAS_CLIENT_SECRET ` | SLAS client secret (omit for public clients) | No |
70+ | ` --short-code ` | ` SFCC_SHORTCODE ` | SCAPI short code | Yes |
71+ | ` --redirect-uri ` | | Redirect URI | No |
72+ | ` --shopper-login ` | | Registered customer login | No |
73+ | ` --shopper-password ` | | Registered customer password (prompted interactively if omitted) | No |
74+
75+ \* ` --site-id ` can be auto-discovered from the SLAS client configuration when using auto-discovery.
76+
77+ ### Flows
78+
79+ The command automatically selects the appropriate authentication flow:
80+
81+ | Scenario | Flow |
82+ | ----------| ------|
83+ | No ` --slas-client-secret ` | Public client PKCE (authorization_code_pkce) |
84+ | With ` --slas-client-secret ` | Private client (client_credentials) |
85+ | With ` --shopper-login ` | Registered customer login |
86+ | No ` --slas-client-id ` | Auto-discovers first public client via SLAS Admin API |
87+
88+ ### Examples
89+
90+ ``` bash
91+ # Guest token with auto-discovery (finds first public SLAS client)
92+ b2c slas token --tenant-id abcd_123 --site-id RefArch
93+
94+ # Guest token with explicit public client (PKCE flow)
95+ b2c slas token --slas-client-id my-client \
96+ --tenant-id abcd_123 --short-code kv7kzm78 --site-id RefArch
97+
98+ # Guest token with private client (client_credentials flow)
99+ b2c slas token --slas-client-id my-client --slas-client-secret sk_xxx \
100+ --tenant-id abcd_123 --short-code kv7kzm78 --site-id RefArch
101+
102+ # Registered customer token
103+ b2c slas token --tenant-id abcd_123 --site-id RefArch \
104+ --shopper-login user@example.com --shopper-password secret
105+
106+ # JSON output (includes refresh token, expiry, usid, etc.)
107+ b2c slas token --tenant-id abcd_123 --site-id RefArch --json
108+
109+ # Use token in a subsequent API call
110+ TOKEN=$( b2c slas token --tenant-id abcd_123 --site-id RefArch)
111+ curl -H " Authorization: Bearer $TOKEN " \
112+ " https://kv7kzm78.api.commercecloud.salesforce.com/..."
113+ ```
114+
115+ ### Output
116+
117+ - ** Normal mode** : prints the raw access token to stdout (pipeable)
118+ - ** JSON mode** (` --json ` ): returns full token details:
119+
120+ ``` json
121+ {
122+ "accessToken" : " ..." ,
123+ "refreshToken" : " ..." ,
124+ "expiresIn" : 1800 ,
125+ "tokenType" : " Bearer" ,
126+ "usid" : " ..." ,
127+ "customerId" : " ..." ,
128+ "clientId" : " ..." ,
129+ "siteId" : " RefArch" ,
130+ "isGuest" : true
131+ }
132+ ```
133+
134+ ### Configuration
135+
136+ These values can also be set in ` dw.json ` :
137+
138+ ``` json
139+ {
140+ "tenant-id" : " abcd_123" ,
141+ "short-code" : " kv7kzm78" ,
142+ "slas-client-id" : " my-public-client" ,
143+ "site-id" : " RefArch"
144+ }
145+ ```
146+
147+ ---
148+
52149## b2c slas client list
53150
54151List SLAS clients for a tenant.
0 commit comments