Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

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

Function: isStatefulTokenValid()

isStatefulTokenValid(session, requiredScopes, expiryBufferSec, requiredClientId?): boolean

Defined in: packages/b2c-tooling-sdk/src/auth/stateful-store.ts:146

Checks whether the stored access token is present and valid: not expired (with a small buffer), optionally satisfies required scopes, and optionally matches the expected client ID. Does not perform network calls.

Parameters

session

StatefulSession

Session from getStoredSession()

requiredScopes

string[] = []

If provided, token must include all of these scopes

expiryBufferSec

number = EXPIRY_BUFFER_SEC

Seconds before exp to treat token as expired (default 60)

requiredClientId?

string

If provided, session clientId must match

Returns

boolean

true if token is present and valid for use

Released under the Apache-2.0 License.