Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / auth / BasicAuthStrategy

Class: BasicAuthStrategy

Defined in: packages/b2c-tooling-sdk/src/auth/basic.ts:24

Basic authentication strategy for WebDAV operations.

Encodes username and access key as Base64 for HTTP Basic auth. Implements the AuthStrategy interface.

Example

typescript
import { BasicAuthStrategy } from '@salesforce/b2c-tooling-sdk';

const auth = new BasicAuthStrategy('username', 'access-key');
const response = await auth.fetch('https://webdav.example.com/path');

Implements

Constructors

Constructor

new BasicAuthStrategy(user, pass): BasicAuthStrategy

Defined in: packages/b2c-tooling-sdk/src/auth/basic.ts:33

Creates a new BasicAuthStrategy instance for HTTP Basic authentication.

Parameters

user

string

The username for Basic authentication

pass

string

The password or access key for Basic authentication

Returns

BasicAuthStrategy

Methods

fetch()

fetch(url, init): Promise<Response>

Defined in: packages/b2c-tooling-sdk/src/auth/basic.ts:40

Performs a fetch request with authentication. Implementations MUST handle header injection and 401 retries (token refresh) internally.

Parameters

url

string

init

FetchInit = {}

Returns

Promise<Response>

Implementation of

AuthStrategy.fetch


getAuthorizationHeader()

getAuthorizationHeader(): Promise<string>

Defined in: packages/b2c-tooling-sdk/src/auth/basic.ts:47

Optional: Helper for legacy clients (like a strict WebDAV lib) that need the raw header.

Returns

Promise<string>

Implementation of

AuthStrategy.getAuthorizationHeader

Released under the Apache-2.0 License.