Disable Username-Password-Authentication for an Auth0 application

Hi all,

I am using latest auth0 terraform to configure our application domain. our usecase to create custom database and associate that database to a Web application.
I could achieve this using “auth0-client”, “auth0-connections” , “auth0-connection-client” .

however i could not disable default “Username-Password-Authentication” database asscoiated to that Webapp. any idea how to disable that using Terraform. Please help.

thanks
ssj

Hi @sadhasivam :wave:

Welcome to the Community!

To be able to toggle off the pre-generated (and default) Username-Password-Authentication connection you will need to import the resource into Terraform as described in the following link.

After doing this, you will be able to manage this connection through your Terraform configuration.

Let me know if you have any trouble with this!

Thanks. i tried importing. i am not sure how i can disconnect the “Username-Password-Authentication” database that is automatically tied to the terraform created new apps.

Steps.i followed

  1. Get the Tenant ClientID , ClientSecret. Domain
  2. Creater Terraform managed machine to machine app
  3. Use terraform to create an App (singlePage)
  4. Create Custom database
  5. Use Grants to enable custom database to new App

Expected out:
New App connected with one custom user Database

What happened
I see two databases connected to the app.

  1. Custom user database created via terraform
  2. Successfully gave grants to newly created custom database from the App.
  3. Default Username-Password-Authetnication database created

I am not sure how to de-activate the connection between app & default DB via terraform. Importing the resource to terraform don’t have any flag to disable or something.

thoughts?

Hi @sadhasivam

Thanks for confirming that!

It sounds like the Tenant flag enable_client_connections is enabled, which will result in all current connections being enabled on newly created Applications by default. There are two different ways you can toggle this off.

  1. Through your Terraform configuration via the auth0_tenant resource. E.g.
resource "auth0_tenant" "main_tenant" {
  friendly_name = "My Tenant"
  support_email = "support@example.com"

  flags {
    enable_client_connections = false
  }
}
  1. Through your Auth0 Tenant Dashboard: Navigate Settings -> Advanced and then scroll down until you see Enable Application Connections and toggle the button off.

After disabling this setting, your newly created Applications will no longer have all the connections enabled by default, and instead you will be able to assign the connections in Terraform through the auth0_connection_client resource.

Let me know how you get on!

Thanks a lot @james.merrigan your advice worked out. appreciate your help.

Hi, I will be providing an updated solution on the matter as we are currently reviewing the contents of our community!

You are asking how to disable the default Username-Password-Authentication database connection on a Web application using Terraform, after creating a custom database connection and associating it with that application.

[Summary]

Turn off the tenant setting that enables all connections on new applications, then manage each application’s connections with the auth0_connection_clients resource.

[Root Cause]

When the tenant flag enable_client_connections is true, Auth0 enables every existing connection, including Username-Password-Authentication, on each newly created application. The default connection stays linked to your Web application until its connection-to-application list is set in Terraform.

[Solution]

There are two primary ways you can toggle this setting off:

1. Through the Auth0 Tenant Dashboard :desktop_computer:

  1. Navigate to Settings > Advanced.

  2. Scroll down to the Enable Application Connections section.

  3. Toggle the button OFF to disable automatic mapping.

2. Through your Terraform Configuration (with Migration Warnings) :hammer_and_wrench:

You can manage this setting at the tenant level via the auth0_tenant resource:

resource "auth0_tenant" "main_tenant" {
  friendly_name = "My Tenant"
  support_email = "support@example.com"
  
  flags {
    enable_client_connections = false
  }
}

:warning: Critical Migration & Versioning Risks (Terraform v1.29.0+)

While toggling enable_client_connections off solves the automatic enablement behavior, please keep the following platform changes in mind for managing connections going forward:

  • Management API Deprecations: Auth0 is actively deprecating legacy Enabled Client Management from its primary connection endpoints.

  • Terraform Provider Changes: If you are using the Auth0 Terraform Provider v1.29.0 or later, the way enabled clients are tracked has changed significantly.

    • If your provider version is older, managing bindings directly via connection resources can lead to state drifts and stale configurations.

    • For modern configurations, once enable_client_connections is set to false, you should strictly manage association mappings utilizing the auth0_connection_client resource rather than inline connection blocks to ensure compatibility with Auth0’s long-term API roadmap.

Kind Regards,
Nik