b2c-config
npx skills add https://github.com/salesforcecommercecloud/b2c-developer-tooling --skill b2c-config
Agent 安装分布
Skill 文档
B2C Config Skill
Use the b2c setup config command to view the resolved configuration and understand where each value comes from. This is essential for debugging configuration issues and verifying that the CLI is using the correct settings.
Tip: If
b2cis not installed globally, usenpx @salesforce/b2c-cliinstead (e.g.,npx @salesforce/b2c-cli setup config).
When to Use
Use b2c setup config when you need to:
- Verify which configuration file is being used
- Check if environment variables are being read correctly
- Debug authentication failures by confirming credentials are loaded
- Understand credential source priority (dw.json vs env vars vs plugins)
- Identify hostname mismatch protection issues
- Verify MRT API key is loaded from ~/.mobify
Examples
View Current Configuration
# Display resolved configuration (sensitive values masked by default)
b2c setup config
# View configuration for a specific instance from dw.json
b2c setup config -i staging
# View configuration with a specific config file
b2c setup config --config /path/to/dw.json
Debug Sensitive Values
# Show actual passwords, secrets, and API keys (use with caution)
b2c setup config --unmask
JSON Output for Scripting
# Output as JSON for parsing in scripts
b2c setup config --json
# Pretty-print with jq
b2c setup config --json | jq '.config'
# Check which sources are loaded
b2c setup config --json | jq '.sources'
Understanding the Output
The command displays configuration organized by category:
- Instance: hostname, webdavHostname, codeVersion
- Authentication (Basic): username, password (for WebDAV)
- Authentication (OAuth): clientId, clientSecret, scopes, authMethods
- TLS/mTLS: certificate, certificatePassphrase, selfSigned (for two-factor auth)
- SCAPI: shortCode
- Managed Runtime (MRT): mrtProject, mrtEnvironment, mrtApiKey
- Metadata: instanceName (from multi-instance configs)
- Sources: List of all configuration sources that were loaded
Each value shows its source in brackets:
[DwJsonSource]– Value from dw.json file[MobifySource]– Value from ~/.mobify file[SFCC_*]– Value from environment variable[password-store]– Value from a credential plugin
Configuration Priority
Values are resolved with this priority (highest to lowest):
- CLI flags and environment variables
- Plugin sources (high priority)
- dw.json file
- ~/.mobify file (MRT API key only)
- Plugin sources (low priority)
- package.json b2c key
When troubleshooting, check the source column to understand which configuration is taking precedence.
Common Issues
Missing Values
If a value shows -, it means no source provided that configuration. Check:
- Is the field spelled correctly in dw.json?
- Is the environment variable set?
- Does the plugin provide that value?
Wrong Source Taking Precedence
If a value comes from an unexpected source:
- Higher priority sources override lower ones
- Credential groups (username+password, clientId+clientSecret) are atomic
- Hostname mismatch protection may discard values
Sensitive Values Masked
By default, passwords and secrets show partial values like admi...REDACTED. Use --unmask to see full values when debugging authentication issues.
Getting Admin OAuth Tokens
Use b2c auth token to get an admin OAuth access token for Account Manager credentials (OCAPI and Admin APIs). This is useful for testing APIs, scripting, or CI/CD pipelines.
# Get access token (outputs raw token to stdout)
b2c auth token
# Get token with specific scopes
b2c auth token --scope sfcc.orders --scope sfcc.products
# Get token as JSON (includes expiration and scopes)
b2c auth token --json
# Use in curl for OCAPI calls
curl -H "Authorization: Bearer $(b2c auth token)" \
"https://your-instance.dx.commercecloud.salesforce.com/s/-/dw/data/v24_1/sites"
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).
Note: This command returns admin tokens for OCAPI/Admin APIs. For shopper tokens (SLAS), see the b2c-slas skill.
More Commands
See b2c setup --help for other setup commands including b2c setup skills for AI agent skill installation.