Integrate wolfcola devtools with Ping Identity Journey/Tree-based authentication
Journey Integration
Ping Identity Journey (formerly Tree-based authentication) uses a series of callbacks to guide users through authentication. The wolfcola devtools bridge provides a dedicated adapter for instrumenting Journey flows.
Setup
Install the Bridge
npm install @wolfcola/devtools-bridge
Attach the Journey Bridge
import { attachJourneyBridge } from '@wolfcola/devtools-bridge';
const handle = attachJourneyBridge(journeyClient);
// Optionally pass SDK config and devtools options
const handle = attachJourneyBridge(journeyClient, sdkConfig, { consoleLog: true });
The bridge subscribes to the client via client.subscribe() and reads state via client.getState().
Cleanup
handle.detach();
Always call handle.detach() when you are done. Failing to do so may cause memory leaks from lingering event listeners.
What Gets Captured
With the Journey bridge attached, the following events are emitted:
sdk:config-- Emitted once on the first mutation (whenconfigis provided). Contains the SDK configuration object.sdk:journey-step-- Emitted for each fulfilled or rejected mutation. ContainsJourneyDatawith the step type and associated fields.
How It Works
The bridge monitors RTK Query state at journeyReducer.mutations. It expects a JourneySubscribable interface:
interface JourneySubscribable {
subscribe: (listener: () => void) => () => void;
getState: () => unknown;
}
On each subscription callback:
- The bridge decodes the state with
Schema.decodeUnknownOptionlooking forjourneyReducer.mutations - For each mutation entry not yet emitted, it checks if
statusis'fulfilled'or'rejected' - Fulfilled mutations: The step payload is decoded and mapped to
JourneyData. ThestepTypeis determined by:authIdpresent ='Step',successUrlpresent ='LoginSuccess', otherwise'LoginFailure' - Rejected mutations: A
LoginFailureevent is emitted with the extracted error message - Stale mutation IDs no longer in the cache are automatically pruned from the deduplication set
JourneyData Fields
stepType:'Step'|'LoginSuccess'|'LoginFailure'callbacks: Array of callback objects from the stepauthId,tokenId,successUrl: Step identifiersrealm,stage,header,description: Step metadataerrorCode,errorMessage,errorReason: Error details (forLoginFailure)
Troubleshooting
- No events appearing -- Verify that
window.__PING_DEVTOOLS_EXTENSION__exists. The bridge only emits events when the Ping DevTools extension is detected. - Missing step transitions -- The bridge deduplicates by mutation request ID. Each mutation is only emitted once.
- Pending mutations ignored -- Only
fulfilledandrejectedmutations are emitted. Pending mutations are skipped.