authentication.authorized¶
authentication.authorized
is an event on the Event Bus that occurs after a user has authorized.
Event body¶
none
Example¶
In this example we listen to authentication.authorized
event and perform an action whenever it's emitted.
useStorefront(async (storefront) => {
storefront.eventBus.on('authentication.authorized', () => {
console.log('A user has authorized!')
});
});
Example¶
In this example we use a Message Storage API to retrieve an array of past authentication.authorized
events.
useStorefront((storefront) => {
const messageStorageApi = storefront.getApiSync('messageStorageSystemApi');
const pastAuthorizedEvents = messageStorageApi.getChannelMessages('authentication.authorized');
if (pastAuthorizedEvents.length > 0) {
pastAuthorizedEvents.forEach(({ body: eventBody }) => {
console.log('perform action on every past event');
});
}
});