Auth0 Home Blog Docs

Custom DB - Can I upload/download scripts instead of using Dashboard?

Using the dashboard is straightforward enough. But I’d like to test scripts in the sandbox, and then deploy debugged scripts to all my tenants as part of my build/release process. This would be nicer than a bunch of cutting and pasting.

Is this possible?

Thank you,
Chris

Hi @chris-at-arundo,

I haven’t tried updating a connection with a custom DB script via the management API, but when you get the JSON document for a connection, the custom DB scripts are in the customScripts object under the options object:

    "customScripts": {
      "get_user": "function getByEmail(name, callback) {\n    ...
      "login": "//when you log in, connect to the LDAP with your ...
    },

Note that each script is formatted as a single long string with embedded newlines. You could try hitting the /patch_connections_by_id endpoint with a new "options": { "customScripts": { "get_user": ... payload.

Thanks so much for the quick response! This looks pretty promising.

I will check it out tomorrow and post results.

Chris

Hi @chris-at-arundo,

I should have thought of this earlier: the github deployments extension and the deploy CLI both support deploying custom DB scripts:

You might find the extension and / or deploy CLI themselves useful or, again, the code behind them may prove instructive.

Thanks for this too! Those look like they could be perfect. I’ve been slow in checking them out, but I solemnly swear to post results.