Skip to main content

Listen to User Events

After signing in a user, you can subscribe to listen to specific user events and get notified when such an event happens through the onUserEvent method. You can listen to the following user events.

user:signinTriggered whenever a new user session is created.
user:signoutTriggered when a user session is deleted. If signOutAll or signOutAllExceptCurrent method is called then for each deleted sesssion a separate user:signout event is triggered.
user:pwdchangeTriggered when the user password changes, either through direct password update or password reset.
user:emailchangeTriggered whenever the email of the user changes.
user:phonechangeTriggered whenever the phone number of the user changes.
agnost.auth.onUserEvent((eventName, session) =>
console.log("User event", eventName, session),

An active user session is required (e.g., user needs to be logged in) to call this method.


Here you can find parameters for the onUserEvent method.



Data type



1listenerFunctionYesThe listener function. This function gets two input parameters the name of the event that is being triggered and the user session object that has triggered the event. If the event is triggered by the user without a session, then the session value will be null.