@salesforce/b2c-tooling-sdk / clients / createSlasClient
Function: createSlasClient()
createSlasClient(
config,auth):SlasClient
Defined in: packages/b2c-tooling-sdk/src/clients/slas-admin.ts:106
Creates a typed SLAS Admin API client.
Returns the openapi-fetch client directly, with authentication handled via middleware. This gives full access to all openapi-fetch features with type-safe paths, parameters, and responses.
Parameters
config
SLAS client configuration
auth
Authentication strategy (typically OAuth)
Returns
Typed openapi-fetch client
Examples
ts
// Create SLAS client with OAuth auth
const oauthStrategy = new OAuthStrategy({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
scopes: ['SLAS_ORGANIZATION_ADMIN']
});
const client = createSlasClient(
{ shortCode: 'kv7kzm78' },
oauthStrategy
);
// Create or update a SLAS client
const { data, error } = await client.PUT('/tenants/{tenantId}/clients/{clientId}', {
params: {
path: { tenantId: 'your-tenant', clientId: 'new-client-id' }
},
body: {
clientId: 'new-client-id',
name: 'My SLAS Client',
channels: ['RefArch'],
scopes: ['sfcc.products', 'sfcc.catalogs'],
redirectUri: ['http://localhost:3000/callback'],
secret: '',
isPrivateClient: true
}
});ts
// List all clients for a tenant
const { data, error } = await client.GET('/tenants/{tenantId}/clients', {
params: { path: { tenantId: 'your-tenant' } }
});