With a Custom Database, after the Create script runs, I need to save a value I get back from the external DB to the user’s profile in Auth0.
How do I do that?
Thanks
With a Custom Database, after the Create script runs, I need to save a value I get back from the external DB to the user’s profile in Auth0.
How do I do that?
Thanks
Hi there @jdrew1
The Create script for custom databases are used to create users in the external database whenever they authenticate through Auth0’s Universal login, meaning that you do not get any value back from the DB here. This is also mentioned in our documentation:
This script is optional. If it’s enabled, when a user signs up through Universal Login or is created through the Auth0 Dashboard or Auth0 Management API, Auth0 will run the script to create a corresponding user record in the external database.
Are you perchance talking about the Login or Get User scripts? I would suggest referring to your documentation regarding the matter and if you have any other additional questions please let us know!
Kind Regards,
Nik
Hi-
Thanks. Here’s what I mean:
When the Create script runs, it runs CreateUserInExternalDB() which returns ExternalDBId.
How do I save ExternalDBId to the user’s Auth0 profile?
For instance, when the login script returns, you can add profile info to the user object.
There doesn’t seem to be anything similar in the create script.
Would I need to access the management api? Or can the data be passed to the post registration action?
Thanks
Ah. Login script runs directly after the create script runs. So the user profile data can be saved there. Missed that detail.
That is right!
Glad that you were able to find that out!
If you have any other questions regarding custom databases, let me know!
Kind Regards,
Nik