Returning Metadata after Custom Database Login

Problem statement

In the Manage Metadata documentation, it is referenced that it is not recommended that app_metadata or user_metadata be returned by

  • custom DB scripts

Solution

CustomDB is not intended for capturing app_metadata and user_metadata if additional data is present from a 3rd party store, there can be many stages that this data might be required to be fetched from upstream.

For example, if this data is coming from an upstream database (and might update), you’ll only be ever able to “pull” this at login. For these cases, Post-Login Action is a better place to extract this information. Ideally Custom DB = Basic Profile + Credentials Store.

This warning is only if the custom DB is not in “import mode”. If this is for migration, it is perfectly reasonable to return both app and user metadata.