Skip to content

Commit 96fd9d8

Browse files
committed
Strengthen authentication coverage in bm CLI docs
bm.md: - Lead the Authentication section with the two flows (client-credentials vs user-auth) and explicit setup before the "defaults" table. - Document --user-auth, --auth-methods, and SFCC_AUTH_METHODS overrides with concrete examples. - Annotate the OCAPI permissions table with which command uses each resource so readers know what to grant. - Add a dedicated subsection on the Manage_Users_Access_Keys BM functional permission required for access-key writes. - Add Configuration Examples block. authentication.md: - Add "BM administration" entry under "Minimal Configuration by Feature" with the importable JSON snippet covering /roles, /users, /users/this, /users/*/access_key/*, and /user_search. - Add a tip box explaining the user-identity requirement on whoami / access-key endpoints and cross-link back to /cli/bm#authentication. Both pages now properly cross-link to each other.
1 parent 3e7fbdc commit 96fd9d8

2 files changed

Lines changed: 99 additions & 17 deletions

File tree

docs/cli/bm.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,66 @@ Commands for administering instance-level Business Manager resources via the OCA
88

99
## Authentication
1010

11-
Most BM commands accept either client credentials or browser-based user authentication. A handful require a *real BM user identity* — the CLI defaults those to user-auth automatically.
11+
BM commands authenticate via OAuth against the configured Commerce Cloud instance. Two flows are supported:
12+
13+
- **Client credentials** — for automation and CI/CD. Configure an Account Manager API client and grant it the OCAPI permissions listed below. Pass credentials via `--client-id` / `--client-secret`, the `SFCC_CLIENT_ID` / `SFCC_CLIENT_SECRET` environment variables, or `dw.json`.
14+
- **User auth (browser)** — for interactive use. Pass `--user-auth` (or run `b2c auth login` once and reuse the saved session). The CLI opens a browser and the resulting token carries your BM user identity.
15+
16+
A handful of endpoints require *a real BM user identity* and cannot use service-client tokens — the CLI defaults those to user-auth automatically:
1217

1318
| Command group | Default auth | Why |
1419
|---|---|---|
1520
| `b2c bm roles ...` | client-credentials → jwt → implicit | OCAPI permissions for `/roles` |
1621
| `b2c bm users {list,get,search,update,delete}` | client-credentials → jwt → implicit | OCAPI permissions for `/users` |
17-
| `b2c bm whoami` | **implicit (browser)** | OCAPI `/users/this` requires the token to resolve to a BM user |
18-
| `b2c bm access-key ...` | **implicit (browser)** | OCAPI access-key endpoints require "a valid user" plus the `Manage_Users_Access_Keys` functional permission |
22+
| `b2c bm whoami` | **implicit (browser)** | `/users/this` requires the token to resolve to a BM user |
23+
| `b2c bm access-key ...` | **implicit (browser)** | Access-key endpoints require *a valid user* plus the `Manage_Users_Access_Keys` BM functional permission |
1924

20-
Override the default with `--auth-methods client-credentials` (or `--client-secret` flags) when your service-client setup is configured to issue user-bearing tokens.
25+
Override the auto-defaulted user-auth with `--auth-methods client-credentials` (or `--client-secret`) when your service-client setup is configured to issue user-bearing tokens. The interactive defaults can also be skipped end-to-end by exporting `SFCC_AUTH_METHODS=client-credentials,jwt` in CI.
2126

22-
For complete setup instructions see the [Authentication Guide](/guide/authentication).
27+
See the [Authentication Guide](/guide/authentication) for end-to-end setup, including the [BM administration OCAPI snippet](/guide/authentication#minimal-configuration-by-feature).
2328

2429
### Required OCAPI Permissions
2530

26-
| Resource | Methods |
27-
|----------|---------|
28-
| `/roles` | GET |
29-
| `/roles/*` | GET, PUT, DELETE |
30-
| `/roles/*/users` | GET, PUT, DELETE |
31-
| `/users` | GET |
32-
| `/users/*` | GET, PATCH, DELETE |
33-
| `/users/this` | GET |
34-
| `/users/*/access_key/*` | GET, PUT, PATCH, DELETE |
35-
| `/user_search` | POST |
36-
37-
Access-key writes additionally require the `Manage_Users_Access_Keys` functional permission on the BM user account.
31+
Add these resources to the Data API client configuration in Business Manager (**Administration** > **Site Development** > **Open Commerce API Settings** > **Data API**):
32+
33+
| Resource | Methods | Used by |
34+
|----------|---------|---------|
35+
| `/roles` | GET | `bm roles list` |
36+
| `/roles/*` | GET, PUT, DELETE | `bm roles get/create/delete` |
37+
| `/roles/*/users` | GET | `bm roles get --expand users` |
38+
| `/roles/*/users/*` | PUT, DELETE | `bm roles grant/revoke` |
39+
| `/roles/*/permissions` | GET, PUT | `bm roles permissions get/set` |
40+
| `/users` | GET | `bm users list` |
41+
| `/users/*` | GET, PATCH, DELETE | `bm users get/update/delete` |
42+
| `/users/this` | GET | `bm whoami`, `bm access-key` (optional login fallback) |
43+
| `/users/*/access_key/*` | GET, PUT, PATCH, DELETE | `bm access-key get/create/set/delete` |
44+
| `/user_search` | POST | `bm users search` |
45+
46+
For an importable JSON snippet covering all BM administration endpoints, see [Minimal Configuration by Feature](/guide/authentication#minimal-configuration-by-feature) in the Authentication Guide.
47+
48+
### Required BM Functional Permission
49+
50+
Access-key writes (`bm access-key {create,set,delete}`) additionally require the **Manage_Users_Access_Keys** BM functional permission on the user account performing the request. Grant it via Business Manager: **Administration** > **Roles & Permissions**. This is why the CLI defaults `bm access-key` commands to user-auth — service clients cannot carry BM functional permissions.
51+
52+
### Configuration Examples
53+
54+
```bash
55+
# Interactive (browser login on first command, session reused after):
56+
b2c auth login --instance my-sandbox
57+
b2c bm whoami
58+
59+
# Client credentials (where supported):
60+
export SFCC_CLIENT_ID=your-client-id
61+
export SFCC_CLIENT_SECRET=your-client-secret
62+
export SFCC_SERVER=my-sandbox.demandware.net
63+
b2c bm users list
64+
65+
# Force user-auth on a command that defaults to client-credentials:
66+
b2c bm users list --user-auth
67+
68+
# Force client-credentials on a command that defaults to user-auth (advanced):
69+
b2c bm access-key get --auth-methods client-credentials
70+
```
3871

3972
---
4073

docs/guide/authentication.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,55 @@ For operations that interact with B2C Commerce instances (code deployment, jobs,
423423
}
424424
```
425425

426+
**BM administration (`bm roles`, `bm users`, `bm whoami`, `bm access-key`):**
427+
428+
```json
429+
{
430+
"resource_id": "/roles",
431+
"methods": ["get"]
432+
},
433+
{
434+
"resource_id": "/roles/*",
435+
"methods": ["get", "put", "delete"]
436+
},
437+
{
438+
"resource_id": "/roles/*/users",
439+
"methods": ["get"]
440+
},
441+
{
442+
"resource_id": "/roles/*/users/*",
443+
"methods": ["put", "delete"]
444+
},
445+
{
446+
"resource_id": "/roles/*/permissions",
447+
"methods": ["get", "put"]
448+
},
449+
{
450+
"resource_id": "/users",
451+
"methods": ["get"]
452+
},
453+
{
454+
"resource_id": "/users/*",
455+
"methods": ["get", "patch", "delete"]
456+
},
457+
{
458+
"resource_id": "/users/this",
459+
"methods": ["get"]
460+
},
461+
{
462+
"resource_id": "/users/*/access_key/*",
463+
"methods": ["get", "put", "patch", "delete"]
464+
},
465+
{
466+
"resource_id": "/user_search",
467+
"methods": ["post"]
468+
}
469+
```
470+
471+
::: tip BM functional permissions
472+
`bm whoami` and the `bm access-key` family additionally require *a real BM user identity*. Service-client tokens cannot resolve to a BM user, so the CLI defaults these commands to browser-based user auth. Access-key writes also require the **Manage_Users_Access_Keys** BM functional permission on the user account performing the request — grant it via **Administration** > **Roles & Permissions** in Business Manager. See [BM Commands → Authentication](/cli/bm#authentication) for details.
473+
:::
474+
426475
## SCAPI Authentication
427476

428477
SCAPI commands (eCDN, SCAPI schemas, custom APIs) require OAuth authentication with specific roles and scopes.

0 commit comments

Comments
 (0)