---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [auth](../index.md) / UserAuthStrategy

# Interface: UserAuthStrategy

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:45](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L45)

An interactive, token-bearing OAuth strategy — the "user" auth flow
(Authorization Code + PKCE, with the legacy implicit flow as fallback).

Unlike the base [AuthStrategy](AuthStrategy.md), these always expose the access token /
decoded JWT so callers like `auth token` can surface them. Implemented by
`PkceOAuthStrategy`, `ImplicitOAuthStrategy`, and the transitional
`PkceWithImplicitFallbackStrategy`.

## Extends

- [`AuthStrategy`](AuthStrategy.md)

## Methods

### fetch()

> **fetch**(`url`, `init?`): `Promise`\<`Response`\>

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:22](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L22)

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

#### Parameters

##### url

`string`

##### init?

[`FetchInit`](../type-aliases/FetchInit.md)

#### Returns

`Promise`\<`Response`\>

#### Inherited from

[`AuthStrategy`](AuthStrategy.md).[`fetch`](AuthStrategy.md#fetch)

***

### getAuthorizationHeader()

> **getAuthorizationHeader**(): `Promise`\<`string`\>

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:46](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L46)

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

#### Returns

`Promise`\<`string`\>

#### Overrides

[`AuthStrategy`](AuthStrategy.md).[`getAuthorizationHeader`](AuthStrategy.md#getauthorizationheader)

***

### getJWT()

> **getJWT**(): `Promise`\<[`DecodedJWT`](DecodedJWT.md)\>

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:47](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L47)

#### Returns

`Promise`\<[`DecodedJWT`](DecodedJWT.md)\>

***

### getTokenResponse()

> **getTokenResponse**(): `Promise`\<[`AccessTokenResponse`](AccessTokenResponse.md)\>

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:48](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L48)

#### Returns

`Promise`\<[`AccessTokenResponse`](AccessTokenResponse.md)\>

***

### invalidateToken()

> **invalidateToken**(): `void`

Defined in: [packages/b2c-tooling-sdk/src/auth/types.ts:49](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/eee4a3582430c731fadd77072888a1468c2fe25b/packages/b2c-tooling-sdk/src/auth/types.ts#L49)

Optional: Invalidates the cached token, forcing re-authentication on next request.
Used by middleware to retry requests after receiving a 401 response.

#### Returns

`void`

#### Overrides

[`AuthStrategy`](AuthStrategy.md).[`invalidateToken`](AuthStrategy.md#invalidatetoken)
