observe_auth_ensure_username_pw/2

Check the current authentication service policy before creating a username/password identity for a newly signed-up user.

This notification is sent after signup, before ensuring the username_pw identity. It allows services to apply their current configuration when a pending signup is confirmed, instead of relying on the flag saved in the original authentication record. It is not sent when connecting an external identity to an existing user.

Type:

first

Return:

  • true: ensure that the new user has a username/password identity.
  • false: skip creating a username/password identity; existing identities are not removed.
  • undefined: defer to another observer. If no observer answers, use the ensure_username_pw flag from the original #auth_validated{} record.

#auth_ensure_username_pw{} properties:

  • service: atom, the authentication service that validated the user.
  • service_uid: binary, the user's identifier supplied by that service.

Observers should return undefined for services they do not handle.

Edit on GitHub