Update all users with a new rule?

We have a property set on each Auth0 user object, but it’s not searchable since it’s outside the user_metadata / app_metadata objects.
How can I run a rule on all our existing users to transfer the property into the app_metadata object?

Hi @seltar,

Where is the property set?

This is how it appears when I request a list of users from the api.

{
    "created_at": "create date",
    "dateofbirth": "some birthdate",
    "family_name": "Last name",
    "given_name": "First name",
    "identities": [
        {
            "provider": "oauth2",
            "access_token": "some token",
            "user_id": "some user id",
            "connection": "connection name",
            "isSocial": true
        }
    ],
    "name": "Full name",
    "nickname": "Full name",
    "picture": "url to picture",
    "ssn": "I want to copy this field",
    "sub": "some id",
    "updated_at": "update date",
    "user_id": "user id",
    "last_login": "login date",
    "last_ip": "login ip",
    "logins_count": 1,
    "app_metadata": {
        "userId": "internal user id",
        "roles": [
            "internal user role"
        ]
    }
}

So my goal is to copy the ‘ssn’ field over to the ‘app_metadata’ field to make it searchable for all the existing and future users.

You could use a rule to update this attribute as your users log in, or you can use the management API to update all of the users at once.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.