You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/b2c-cli/skills/b2c-config/SKILL.md
+61-23Lines changed: 61 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,54 @@ description: View and debug b2c CLI configuration and understand where credentia
5
5
6
6
# B2C Config Skill
7
7
8
-
Use the `b2c setup inspect` command to view the resolved configuration and understand where each value comes from. Use the `b2c setup instance` commands to manage named instance configurations.
8
+
The B2C CLI (`@salesforce/b2c-cli`) is a command-line tool for Salesforce B2C Commerce development. It provides commands organized by topic: `auth`, `code`, `webdav`, `sandbox`, `mrt`, `scapi`, `slas`, `ecdn`, `job`, `logs`, `sites`, `content`, `cip`, `setup`, and more. Use `b2c --help` or `b2c <topic> --help` for a full list.
9
9
10
-
> **Tip:**`b2c setup config` still works as an alias. If `b2c` is not installed globally, use `npx @salesforce/b2c-cli` instead (e.g., `npx @salesforce/b2c-cli setup inspect`).
10
+
> **Tip:** If `b2c` is not installed globally, use `npx @salesforce/b2c-cli` instead (e.g., `npx @salesforce/b2c-cli setup inspect`).
11
11
12
-
## When to Use
12
+
## Authentication
13
+
14
+
Most commands that interact with a B2C Commerce instance require authentication. The CLI supports several methods:
15
+
16
+
-**Client credentials (API client):** Configure `clientId` and `clientSecret` in dw.json or environment variables. This is the default for automated/CI use.
17
+
-**Browser-based (implicit OAuth):** Use `--user-auth` on any OAuth-enabled command to authenticate interactively via the browser. This opens Account Manager in your default browser for login.
18
+
-**Basic auth:** Configure `username` and `password` for WebDAV operations.
19
+
-**Stateful sessions:** Use `b2c auth login` for persistent browser-based login sessions.
20
+
21
+
### `--user-auth` Flag
22
+
23
+
Many commands support `--user-auth` to use browser-based implicit OAuth instead of client credentials. This is useful when:
24
+
25
+
- You don't have a `clientSecret` configured
26
+
- You need user-level permissions (e.g., Account Manager admin roles)
27
+
- You're working interactively
28
+
29
+
```bash
30
+
# Interactive browser-based auth for any OAuth command
31
+
b2c sandbox list --user-auth
32
+
b2c scapi schemas list --user-auth
33
+
b2c auth token --user-auth
34
+
```
35
+
36
+
Coding agents can also use `--user-auth` — the browser flow works in any environment where a browser can be opened. The flag is exclusive with `--auth-methods`.
37
+
38
+
## Tenant ID and Organization ID
39
+
40
+
B2C Commerce uses two related identifiers:
41
+
42
+
-**Tenant ID** — the short form (e.g., `zzxy_prd` or `zzxy-prd`)
43
+
-**Organization ID** — the SCAPI form with `f_ecom_` prefix (e.g., `f_ecom_zzxy_prd`)
44
+
45
+
The CLI automatically normalizes and translates between these formats. You can provide either form in configuration or flags — the CLI handles the conversion. It also extracts tenant IDs from hostnames (e.g., `zzxy-prd.dx.commercecloud.salesforce.com` resolves to `zzxy_prd`).
46
+
47
+
In dw.json or environment variables, use the `tenantId` config key. The CLI will add the `f_ecom_` prefix when making SCAPI calls.
48
+
49
+
## Inspecting Configuration
50
+
51
+
Use `b2c setup inspect` to view the resolved configuration and understand where each value comes from. Use `b2c setup instance` commands to manage named instance configurations.
52
+
53
+
> **Note:**`b2c setup config` works as an alias for `b2c setup inspect`.
54
+
55
+
### When to Use
13
56
14
57
Use `b2c setup inspect` when you need to:
15
58
@@ -20,15 +63,6 @@ Use `b2c setup inspect` when you need to:
20
63
- Identify hostname mismatch protection issues
21
64
- Verify MRT API key is loaded from ~/.mobify
22
65
23
-
Use `b2c setup instance` commands when you need to:
The token is obtained using the `clientId` and `clientSecret` from your configuration (dw.json or environment variables). If only `clientId` is configured, an implicit OAuth flow is used (browser-based).
246
+
The token is obtained using the `clientId` and `clientSecret` from your configuration (dw.json or environment variables). If only `clientId` is configured, or `--user-auth` is used, an implicit OAuth flow is used (browser-based).
209
247
210
248
**Note:** This command returns **admin** tokens for OCAPI/Admin APIs. For **shopper** tokens (SLAS), see the [b2c-slas skill](../b2c-slas/SKILL.md).
0 commit comments