Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

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.

EventDirectionDescription
auth/errorEmitsEmitted when an error occurs
auth/permissionsEmitsEmitted 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 }
PropertyTypeDescription
sourcestringSee type definition in source code
typestringSee type definition in source code
errorError | stringSee 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 listening
authErrorListener.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 listening
authPermissionsListener.off();