You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/js-auth/README.md
+21-1Lines changed: 21 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ It works everywhere — on your browser, server, or at the edge.
26
26
-[Utilities](#utilities)
27
27
-[Revoking a token](#revoking-a-token)
28
28
-[Decoding an access token](#decoding-an-access-token)
29
+
-[Checking if an access token is expired](#checking-if-an-access-token-is-expired)
29
30
-[Verifying an access token](#verifying-an-access-token)
30
31
-[Getting the Core API base endpoint](#getting-the-core-api-base-endpoint)
31
32
-[Getting the Provisioning API base endpoint](#getting-the-provisioning-api-base-endpoint)
@@ -249,9 +250,14 @@ flowchart TB
249
250
250
251
You can enable debugging and assign custom names to your storage instances for better visibility into token operations:
251
252
252
-
-**`debug`** — When set to `true`, logs detailed information about token operations (creation, retrieval, refresh, etc.).
253
+
-**`debug`** — When set to `true`, logs **state transitions** only: cache misses, token refreshes, authorizations stored/removed, and errors. Routine cache hits are silent, so setups that call `getAuthorization()` on every API request (e.g. when implementing the SDK's `getAccessToken` callback) don't flood the logs. Set it to `"verbose"` to also log steady-state operations (every storage read and cache hit).
253
254
-**`name`** — A custom identifier for your storage instance, useful when using multiple storages or composite storage configurations. The `name` is an attribute of the storage itself (as shown in the [`memoryStorage` example above](#storage-strategy)).
254
255
256
+
The `createCompositeStorage` helper accepts its own `debug` option, following the same rule: a hit on the first (fastest) storage is steady state, while falling back to a slower storage is a transition worth logging.
257
+
258
+
> [!WARNING]
259
+
> When debug mode is enabled, full authorization objects (including access tokens and refresh tokens) are logged to the console. It is intended for local development only — in serverless/edge environments, logs may be forwarded to external log aggregation services.
260
+
255
261
```diff
256
262
const salesChannel = makeSalesChannel(
257
263
{
@@ -671,6 +677,20 @@ if (jwtIsSalesChannel(decodedJWT.payload)) {
0 commit comments