PelcroUserRefresh

Fired when user session is refreshed

Overview

Fired when a user's session is refreshed. This typically happens during SDK boot when restoring an existing session.


Triggered By

MethodDescription
Pelcro.user.refresh()Manually refreshing user session
SDK bootAutomatic session restoration

Event Detail

The event.detail object contains the refreshed user data:

PropertyTypeDescription
idnumberUser's unique identifier
emailstringUser's email address
auth_tokenstringRefreshed authentication token
subscriptionsarrayCurrent subscriptions

Example

document.addEventListener('PelcroUserRefresh', (event) => {
  const user = event.detail;

  console.log(`Session refreshed for: ${user.email}`);

  // Update any cached user data
  updateCachedUserData(user);
});

Related