To give my users a seamless Auth0 experience, I’m migrating them from an existing wordpress service automatically. I’ve set up working custom database (called “Wordpress”) as well as my auth0 database (called “Database”), but I’m having trouble logging people in.
I’m using a customised hosted login page using auth0.js v8. Here’s the relevant login code:
function login(e) {
e.preventDefault();
var username = document.getElementById('email').value;
var password = document.getElementById('password').value;
webAuth.redirect.loginWithCredentials({
connection: "Wordpress",
username: username,
password: password
}, function(err) {
if (err) displayError(err);
});
}
As you can see, I have to specify the connection I want to use. If I set “Wordpress”, I can log in OK with Wordpress users. If I set “Database” I can log in with Auth0 users. BUT, I can’t get it to work for both at the same time, as the custom DB migration should. Am I missing something obvious that anyone can think of?
I’ve dropped back to the default login page, and that’s not working either. I can log in with Auth0 users, but not with Wordpress users. It seems the passthrough from Auth0 to Wordpress is the bit that’s missing.
If, by telling the login page to use the “Wordpress” connection, I go straight into the box “Are name & password valid in external DB”, then the Wordpress login and migration all works. The broken part is definitely that crossed-through link.
Just to be sure, did you follow the migration flow described here Configure Automatic Migration from Your Database , enabling the Use my own database option and implementing the database action scripts? And is this the “wordpress” database you refer to?
I may be missing something, but when migrating users from an external database into Auth0, there should be only one database connection and you seem to have two. The crossed “No” in your diagram refers to the user not being in Auth0’s database and the database action script being executed to fetch the user from your external database source. Please see this community post for more context: Create a new user in Auth0 managed db while migrating from custom db - Auth0 Community
Still, if you now have two database connections in Auth0 and you’re using the Hosted Login Page, you can change the [allowedConnections] (Lock Configuration Options) configuration option of Lock to allow both those connections.
Oh, that’s interesting. Have I fundamentally misunderstood something? I was under the impression that there needed to be two database connections, not that it was all set up on one. Let me check.
Yep, that was it. I should only have had one database connection.
I think I was misled early on by the first section in the documentation being “create a new custom database”. As there is already a default database, that gave the impression I should have two.
Thank you very much for taking the time to respond, you’ve resolved a lot of frustration