Custom Database and Wordpress

I am trying to implement Auth0 on my wordpress install.
I am using the WP plugin, and it works if I use the Auth0 DB and add a username and password manually.

What I want to happen is that everytime a user logs in for the first time, that Auth0 checks my WP database for validation and if successful moves the information up to the Auth0 database.

My questions:

  1. Can this be done through settings within the Wordpress Plugin and Auth0 dashboard?
  2. If no, is the solution to set up connection through custom database?
  3. If yes, I am trying to set up connection with custom database, have it connecting but am getting the following error mysql login script error: “data and hash arguments required” Any idea what the error means or how to fix?

To achieve your desired behaviour, you would use a Custom Database, with Import Users to Auth0 enabled in the connection settings (Auth0 Dashboard). With this, when a user logs in, it will authenticate against your custom database, and on successful login, import the user to Auth0. All successive login attempts by that user will only authenticate against the Auth0 user.

The error you are seeing seems to be specific to the following line:

if (!bcrypt.compareSync(password, user.password)){...

Either the password parameter, or the user.password parameter are null or undefined. You can debug this by using a console.log statement for each of these parameters before the execution of the compare, and see whether they are defined.