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

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

# Class: PkceWithImplicitFallbackStrategy

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:59](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L59)

Wraps a [PkceOAuthStrategy](PkceOAuthStrategy.md) and, on a [PkceGrantUnsupportedError](PkceGrantUnsupportedError.md),
falls back to an [ImplicitOAuthStrategy](ImplicitOAuthStrategy.md) for the same client. The
fallback is attempted at most once and then sticks for the lifetime of this
instance, so subsequent calls go straight to implicit without re-attempting
the failing PKCE flow.

## Implements

- [`UserAuthStrategy`](../interfaces/UserAuthStrategy.md)

## Constructors

### Constructor

> **new PkceWithImplicitFallbackStrategy**(`config`): `PkceWithImplicitFallbackStrategy`

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:66](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L66)

#### Parameters

##### config

[`PkceOAuthConfig`](../interfaces/PkceOAuthConfig.md)

#### Returns

`PkceWithImplicitFallbackStrategy`

## Properties

### authMethod

> `readonly` **authMethod**: `"user"`

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:60](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L60)

Browser auth method represented by this strategy.

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`authMethod`](../interfaces/UserAuthStrategy.md#authmethod)

## Methods

### fetch()

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

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:70](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L70)

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`\>

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`fetch`](../interfaces/UserAuthStrategy.md#fetch)

***

### getAuthorizationHeader()

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

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:85](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L85)

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

#### Returns

`Promise`\<`string`\>

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`getAuthorizationHeader`](../interfaces/UserAuthStrategy.md#getauthorizationheader)

***

### getJWT()

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

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:100](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L100)

#### Returns

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

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`getJWT`](../interfaces/UserAuthStrategy.md#getjwt)

***

### getTokenResponse()

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

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:115](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L115)

#### Returns

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

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`getTokenResponse`](../interfaces/UserAuthStrategy.md#gettokenresponse)

***

### invalidateToken()

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

Defined in: [packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts:130](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/2feab01f654eec77c6d702777ec2818472f131f1/packages/b2c-tooling-sdk/src/auth/oauth-pkce-fallback.ts#L130)

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

#### Returns

`void`

#### Implementation of

[`UserAuthStrategy`](../interfaces/UserAuthStrategy.md).[`invalidateToken`](../interfaces/UserAuthStrategy.md#invalidatetoken)
