Matrix Synapse currently provides the on_user_login callback in the Modules API:
on_user_login
This callback is extremely helpful for building custom login‑related logic, but the parameters it exposes are very limited. At the moment, module developers cannot access important contextual information about the login event, such as:
- the login IP address
- the user-agent / device information
Adding these fields would significantly expand what developers can build. For example, it would enable modules to implement security notifications similar to Telegram’s login alerts:
- “Your account was just logged in from IP X.X.X.X using device Y.”
- “If this wasn’t you, please remove the device in Settings.”
This is valuable for account security, auditing, and user transparency. It also enables custom risk scoring, anomaly detection, and device‑based policy enforcement.
Requested enhancement
Please extend the on_user_login callback signature to include additional parameters, such as:
login_ip: str
user_agent: str
Or alternatively, provide a structured LoginContext object containing these fields.
Why this matters
- Enables security notifications and login anomaly detection
- Allows modules to implement device‑aware policies
- Improves user trust by providing visibility into account activity
- Aligns Synapse with modern security practices used by major messaging platforms
Thank you for considering this enhancement. It would greatly improve the flexibility and security capabilities of Synapse modules.
Matrix Synapse currently provides the
on_user_logincallback in the Modules API:on_user_login
This callback is extremely helpful for building custom login‑related logic, but the parameters it exposes are very limited. At the moment, module developers cannot access important contextual information about the login event, such as:
Adding these fields would significantly expand what developers can build. For example, it would enable modules to implement security notifications similar to Telegram’s login alerts:
This is valuable for account security, auditing, and user transparency. It also enables custom risk scoring, anomaly detection, and device‑based policy enforcement.
Requested enhancement
Please extend the
on_user_logincallback signature to include additional parameters, such as:login_ip: struser_agent: strOr alternatively, provide a structured
LoginContextobject containing these fields.Why this matters
Thank you for considering this enhancement. It would greatly improve the flexibility and security capabilities of Synapse modules.