Auth0 Home Blog Docs

Connection resolver wipes out email address

Using lock.js v11 – I have two database connections and am using connectionResolver to swap them based on if an email is entered or not

Connection A = email address used to log in
Connection B = username used to log in. is set as DEFAULT

If I put an email address in (and password) and hit submit, it wipes out the email address and gives me a validation error that it can’t be blank. If I put the email address back in again and submit, it authenticates just fine.

Nothing special in code…
connectionResolver: function (username, context, cb) {
var isEmail = username.indexOf(’@’) !== -1;
connection = isEmail ? ‘ConnectionA’: ‘ConnectionB’
cb({ type: ‘database’, name: connection });

Hey there @clint.lechner,

Are you seeing any errors in the Auth0 Dashboard or console? If you look at the network requests as you reproduce the workflow, do you see anything there? Thanks!

Nope, it doesn’t seem to get that far. Nothing in the dashboard and nothing in the console. No errors, nothing getting called.

It seems like something quirky with validation because it wipes out the email and throws a validation error of “Can’t be blank” but then immediately typing in the exact same address and clicking on login works.

What I’m really trying to achieve is using 2 database connections with one of them logging in with email and the other with username (and for auth0 to be smart enough to know which connection to use). From the sounds of it that’s a perfect use case for connectionResolver.

Moving forward, can you please record a HAR file of the login attempt and be sure to select “Preserve log” to catch redirects and scrub the file of user passwords before passing in a direct message, thanks!

Am I out of luck as far as using connectionResolver in this fashion? Any additional ideas?

Sorry @clint.lechner, I’m still trying to get to the bottom of this. I appreciate your patience :confused:

No problem, @James.Morrison just curious to see if I’m just nuts or not and if you could replicate this behavior.

Following up @clint.lechner, after some time beating my head against this, I roped a senior engineer into it and it looks like the best course of action is to create a Github issue for this as it’s in Beta.

I would be happy to do this for you or you can share your experience directly in the Github issue. Either way, that seems the best path forward to getting this resolved. Please let me know how you would like me to proceed, thanks!

No biggie, I’ll add an issue.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.