Custom Database Login Script Not Getting Called

Hello,

I am attempting to setup a Custom Database connection to Cognito to do a lazy migration of users. I have added the login and getUser action scripts and done the Save and Try process and they both return results as expected from the Cognito connection. However, when I try to perform an actual login the action scripts do not get called. Cognito is the only database connection enabled for this application.

Any help on what I am missing is greatly appreciated.

Thanks!

Hello @jmusits , thank you for going round to us!

Alright!:+1:t3:
(I)Can you please visit our logs section in your Auth0 tenant to see what’s happening while you’re testing with a real user? (Auth0 tenant → Monitoring → Logs)

(II)On the Application level, are you sure all callback/logout URLs are in the “Allowed callback/logout URL” section?

(III)Not sure here, but I glanced at your “Get user” script and can see that you created a new instance of WrongUsernameOrPasswordError, but I do not see any previous declaration of it or reference to the module you “require()” in there. I’m mentioning it just in case, if you think it’s correct, then I’m sorry :slight_smile:

Please let me know what logs are saying or if you have any follow-up questions!

Thanks for the response. Attached is a screenshot of the relevant logs:

One thing that I have noticed is that it is using the Username-Password-Authentication connection, not the Cognito connection. It was my understanding that if a user does not exist in the Auth0 database it would fall back to the Cognito connection, that doesn’t appear to be the case from the logs.

Looking at the Real-time Webtask Logs through the extension, it does not look like the script is even getting called as nothing shows up there. When I ran the script via Save and Try both the Login and Get User scripts succeed and return results as expected - their logs do show up in the Real-time Webtask Logs, so I am fairly confident that the scripts are correct.

With regards to the calback and logout URLs they have both mydomain/callback and my mydomain/Account/Logout. Are there any additional ones I need to add for a Cognito connection?

One other thing that I have tried based upon some other community posts was to disable the Username-Password-Authentication connection and only have the Cognito connection enabled for the application. This still did not work for logging in with a Cognito user (script still never appears to fire), I am also unable to login with any previously created Auth0 account. How do I manage that so that users in the Auth0 database and in Cognito database are able to login?

Thanks for your help!

Thank you for providing this, @jmusits ! - I can see you have been discussing your issue with our Support Center and that you were able to discover that switching to the Universal Login allowed you to log in to your app with the test user coming from your database.

Another topic that popped up from the discussion is the ability to log in after the user has been successfully migrated to the Auth0’s Username-Password-Authentication database. To allow this, both connections, the custom database connection (to further allow remaining users to be migrated), and the Username-Password-Authentication (to allow already migrated users to log in next time) must be enabled for the app.

On the New Universal Login screen, we can only provide users with one database connection at the time, thus, to authenticate the user through one of them, an /authorize request should contain the connection name parameter - Authenticating users through a specific Connection (database, social, etc.).

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