A rule that saves the IP used on registration?

Hey everyone,

I’m curious if it’s possible to write a rule that writes to user_metadata the IP when a user first registered. In this case, the user is authenticating with Lock and social connections.

I think it boils down to one question: can rules write to user_metadata? Because I know they can read it, and since it can be read, we can detect if the registration fingerprint is saved there or not.


You can get the IP address from context (context.request.ip) and, yes, you can save that to user_metadata, however, you may want to use app_metadata instead if the IP isn’t something the user is meant to edit (see the differences in metadata types here).

1 Like

That is correct! Let us know @dandrei if you have any more questions!