Skip to content

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.

Version: 2.1.1

Events reference

EventDirectionDescription
auth/errorEmitsEmitted when an error occurs

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();