@salesforce/b2c-tooling-sdk / auth / PkceOAuthConfig
Interface: PkceOAuthConfig
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:108
Configuration for the OAuth Authorization Code + PKCE flow.
Extends
Properties
accountManagerHost?
optionalaccountManagerHost:string
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:111
authorize()?
optionalauthorize: (url,context) =>Promise<string|URL>
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:130
Deliver the authorization redirect yourself instead of the SDK's loopback server. Called with the authorize URL; resolve with the full redirect URL (<redirectUri>?code=...&state=...) once Account Manager redirects, or reject to cancel. When set, no local listener is opened and openBrowser and localPort are ignored. The SDK still checks state and performs the PKCE token exchange.
Use this in hosts that can intercept the redirect themselves, such as an Electron BrowserWindow watching will-redirect. redirectUri may be any URI registered for the client, including an app scheme (myapp://callback).
Parameters
url
string
context
redirectUri
string
Returns
Promise<string | URL>
clientId
clientId:
string
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:109
forceRefresh?
optionalforceRefresh:boolean
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:159
Renew a stored sign-in with its refresh token even when the access token is still valid, so it gets a new expiry (used by b2c auth login). Falls back to the browser flow when there is no refresh token or renewal fails.
interactive?
optionalinteractive:boolean
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:140
Whether the strategy may start an interactive sign-in. Defaults to true.
When false, the strategy uses only the cached or stored session and its refresh token. If neither yields an access token it throws AuthRequiredError instead of opening a browser, so the host decides when to ask the user to sign in again. Call PkceOAuthStrategy.signIn to sign in explicitly.
localPort?
optionallocalPort:number
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:113
Local port for the redirect server (default 8080 or SFCC_OAUTH_LOCAL_PORT).
openBrowser()?
optionalopenBrowser: (url,login?) =>Promise<void>
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:117
Custom browser opener. Receives the authorization URL and a handle to cancel the pending login.
Parameters
url
string
login?
Returns
Promise<void>
persistSession?
optionalpersistSession:boolean
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:153
Persist tokens (access + refresh) to disk between CLI invocations, keyed by clientId. When a refresh token is available it is used to silently obtain a new access token instead of opening the browser. Defaults to true.
redirectUri?
optionalredirectUri:string
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:115
Override redirect URI (default http://localhost:${localPort} or SFCC_REDIRECT_URI).
scopes?
optionalscopes:string[]
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:110
sessionBackend?
optionalsessionBackend:AuthSessionBackend
Defined in: packages/b2c-tooling-sdk/src/auth/oauth-pkce.ts:146
Session store for this strategy. Defaults to the process-wide backend (see setAuthSessionBackend), which is a JSON file in the CLI data directory unless a host installs another backend.