Problem statement
We cannot update user_metadata and app_metadata via the profile mapper.
During a user’s first connection, the synchronization of profilMapper data is correctly uploaded in the user’s metadata. Then, if we delete data in AppMetadata which were mapped via the profilMapper and reconnect, the data does not go back.
We checked the boxes:
- enable cache: false
- sync user profile attributes at each login: true
How to make sure that metadata are updated on every connection without exception?
Symptoms
Metadata is not synced from the LDAP connector.
Steps to reproduce
- Configure a local LDAP connector pointed at your tenant. In profilemapper.js, set
profile['app_metadata'] = {"testldapattr":"metadatatest","testldapattr2":"metadatatest2"};
profile['user_metadata'] = {"usertestldapattr":"metadatatest","usertestldapattr2":"metadatatest2"};
- Login as test user - note metadata is synced across
- Remove one of the test app_metadata attributes
- Log out and log in as the test user again - note that metadata does not refresh with the values sent by the LDAP connector, removed metadata remains missing
Solution
Updating metadata via the profile mapper is not supported. You should send these as top-level profile attributes instead and use rules to expose them in tokens etc. if needed.
Metadata should only be managed via Rules/Actions, the Authentication API, the Management API, Tenant Dashboard, or the Lock library: