Connecting external DB

I want to connect Azure SQL to Auth0 as a single source of truth for user authentication and connecting the DB to Auth0 through login custom script seems to be working fine. when “try connection”, it successfully connects to sql db, verifies the user creds, returns user data and the user is created in Auth0 since I turn on auto migration feature.

but when it comes to testing this login flow in the actual application, it does not work. under Authentication > Database > Applications, I turned off default username-password-authentication but turned on custom db for this application. and it looks like user is being authenticated in custom DB, but it does not return auth code when gets redirected to redirect uri and the user is not created in auth0 either. what am I missing here? (error msg says “connection is not enabled” ) (https://localhost:44394/Account/Callback?error=invalid_request&error_description=the%20connection%20is%20not%20enabled)

I found the answer.
for those who may experience the same issue in the future I’ll leave a note here

when initiating auth0 login page in your app, it should point to custom DB that was set up in auth0 rather than default Username-Password-Authentication

   var authorizationUrl = client.BuildAuthorizationUrl()
              .WithResponseType(AuthorizationResponseType.Code)
              .WithClient(clientId)
              .WithConnection("YOUR-CUSTOM-DB-CONNECTION-NOT-Username-Password-Authentication")
              .WithRedirectUrl(root + redirectUri)
              .WithScope("openid offline_access profile email")
              .Build();

Thank you @mkay for sharing your answer with us! :+1: :clap:

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