User Auth data & events
The User Auth drop-in uses the Event Bus to emit and listen to events for communication between drop-ins and external integrations. For common events shared across multiple drop-ins (such as locale
, error
, authenticated
, etc.), see the Common Events Reference.
Emits Reference
Events produced by this drop-in that you can subscribe to.
Event | Direction | Description |
---|---|---|
auth/error | Emits | Emitted when an error occurs |
auth/permissions | Emits | Emitted when permissions are updated |
Listens Reference
Emits and Listens Reference
Event Details
The following sections provide detailed information about each event, including its direction, data payload structure, and usage examples.
auth/error (emits)
Emitted when an error occurs
Data payload
{ source: string; type: string; error: Error | string }
Property | Type | Description |
---|---|---|
source | string | See type definition in source code |
type | string | See type definition in source code |
error | Error | string | See type definition in source code |
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const authErrorListener = events.on('auth/error', (data) => { console.log('auth/error event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningauthErrorListener.off();
auth/permissions (emits)
Emitted when permissions are updated
Data payload
PermissionsModel
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const authPermissionsListener = events.on('auth/permissions', (data) => { console.log('auth/permissions event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningauthPermissionsListener.off();