Auth0 Home Blog Docs

Where Do I Place Database Action Scripts?



Hello I installed a simple create-react-app with Auth0 using this particular script: (create-react-app test-app --scripts-version unicodelabs-react-scripts). A wonderfully simple solution to get going! I then created an express server and mongodb connection, using mongoose, with full CRUD capabilities. Now I’m trying to use the database action scripts from Auth0, but when I put them in my auth.js file rather than the original login() function created I get many errors.

Is there a simple way to simply place these template scripts in the Auth0 files created or do I need to delete the auth files I have and then create a full set of auth files from scratch, implementing these files?


I’m likely missing something here; what do you exactly mean with database action scripts? The scripts/templates that I’m aware are for implementing custom database connections, but those scripts are not meant to be included in client applications. They are used to communicate with an external/custom source of user credentials. This allows your client application to talk a standard authentication protocol with Auth0, for example, OpenID Connect while still validating the actual credentials against a custom store.

The above is usually used when you already have a store containing user credentials and you want to continue to use those same credentials, but through Auth0 so you can leverage built-in support for multiple authentication protocols.

You should update your question to be more clear in what exactly you’re trying to achieve.


OK… Thanks jmangelo… I’m the one that is confused and sorry I wasn’t more clear. What I thought the custom action scripts were for were to implement client side. My goal is to create users and save them to my mongo db when someone logs in through Auth0. I was under the impression I had to take the action scripts and put them into my app (whether in my backend files or client side files I did not know - noobie :slight_smile:

So essentially I can just turn on my custom db connection, customize the action scripts, and then my client app would auth0magically add users to my db?