Custom Connection: Set Environment Variables Documentation Missing

Good day.
We noticed, that while there is an endpoint to set configuration values for the rules, there is no endpoint to set environment variables for custom connections.

While this is not a blocker, I’d like to know if there is workaround by using the update connection endpoint, to see if we can manually set the configuration key values with expected encryption, such as bcrypt.

The only post that talks about document this in more depth is an issue for the auth0 deployment cli tool:

I was unable to find any documentation regarding configuration variables and best practices to deploy them through the management api.

Any leads or help to set this configuration values via Management API will be greatly appreciated.

Hi @eduardo,

Thanks for reaching out to the Auth0 Community!

There are a couple of ways to set the configuration values for your Custom Database Connection.

The first way uses the Auth0 Management API to call the update connection endpoint, as you hinted.

Here is a sample body request that you can use to update with the configuration Key, Value pair:

{
  "display_name": "mycustomdb",
  "options": {
    "enabledDatabaseCustomization": true,
    "configuration": {
        "MY_KEY": "MY_VALUE"
    }
  }
}

Alternatively, you could use the Auth0 Dashboard and navigate to Authentication > YOUR_DB > Custom Database and setting the Key, Value pair manually in the database settings.

Hoped this helps! Please let me know if there are any questions.

Thank you.

1 Like

Hey, thanks for the swift response Reuben!
I have a couple of follow up questions.

  1. Do the values follow a certain encryption/hashing strategy?
  2. Is this something that we could replicate “manually” when updating the values for the configuration key-value pairs? or is this something that can only be achieved by setting the values manually through the dashboard? Or is it sufficient to pass the configuration values without any kind of encryption.

The intention is to track these values in order to reliably regenerate the database in case we need to support other tenants.

Hi @eduardo,

Thank you for your response.

Auth0 uses bcrypt for the encryption/hashing strategy.

After testing this further myself, there is no need to encrypt the value before updating the connection. I have corrected my previous example as well.

You can pass the Key, Value pair as plain-text to the endpoint, and Auth0 will automatically encrypt these values using bcrypt. After making these changes, I verified that the values are encrypted by calling the Get a connection endpoint.

Please let me know how this works for you.

Thank you.