Skip to content

docs: custom db connections maintenance - #1638

Open
hazel-nut wants to merge 4 commits into
mainfrom
docs/ia-custom-database-connections
Open

docs: custom db connections maintenance#1638
hazel-nut wants to merge 4 commits into
mainfrom
docs/ia-custom-database-connections

Conversation

@hazel-nut

@hazel-nut hazel-nut commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

two major bits of maintenance work:

  • massively reduces repeated information about custom dbs and action scripts

    specifically, takes info across like nine pages on 1) what custom dbs are, 2) what action scripts are, and 3) recommendations for action scripts and organizes them onto 1) the existing custom db landing page, 2) the existing action scripts landing page, and 3) a singular new best practices page.

    this results in removing six pages (anatomy.mdx, connection-security.mdx, environment.mdx, execution.mdx, overview-custom-db-connections.mdx, and templates.mdx).

  • create db connections article rewritten

two smaller changes:

  • action script pages now use CodeGroups for samples and no longer have extraneous "example" headers

  • test custom db connections edited (mostly just to use tabs) but content untested and largely unchanged; do not evaluate for accuracy

Checklist

  • I've read and followed CONTRIBUTING.md.
  • I've tested the site build for this change locally.
  • I've made appropriate docs updates for any code or config changes.
  • I've coordinated with the Product Docs and/or Docs Management team about non-trivial changes.

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0 🟢 Ready View Preview Jul 29, 2026, 5:32 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0-docs-dev 🟢 Ready View Preview Jul 29, 2026, 5:33 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
auth0-docs-staging 🟢 Ready View Preview Jul 29, 2026, 5:33 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

…ons' into docs/ia-custom-database-connections
@github-actions

Copy link
Copy Markdown
Contributor

Summary

Status Count
🔍 Total 97
✅ Successful 5
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 91
❓ Unknown 0
🚫 Errors 1
⛔ Unsupported 0

Errors per input

Errors in main/docs/authenticate/database-connections/custom-db/custom-database-connections-scripts.mdx

"docs/authenticate/database-connections/custom-db/templates/verify",
"docs/authenticate/database-connections/custom-db/templates/change-email"
"docs/authenticate/database-connections/custom-db/templates/change-email",
"docs/authenticate/database-connections/custom-db/action-script-best-practices"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting, maybe 1 more +tab

Comment on lines +40 to +74
function login(userNameOrEmail, password, callback) {
const hashedPassword = hash(password);
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
body: {
email: userNameOrEmail,
password: hashedPassword
}
};

fetch(apiEndpoint, options)
.then((response) => {
if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}

return response.json();
})
.then((response) => {
if (response.err) {
return callback(new Error(`Error authenticating user: ${err}`));
}

let profile = {
email: response.profileData.email,
username: response.profileData.username
};

return callback(null, profile);
})
.catch((err) => {
return callback(new Error(`An error occurred: ${err}`));
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function login(userNameOrEmail, password, callback) {
const hashedPassword = hash(password);
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
body: {
email: userNameOrEmail,
password: hashedPassword
}
};
fetch(apiEndpoint, options)
.then((response) => {
if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}
return response.json();
})
.then((response) => {
if (response.err) {
return callback(new Error(`Error authenticating user: ${err}`));
}
let profile = {
email: response.profileData.email,
username: response.profileData.username
};
return callback(null, profile);
})
.catch((err) => {
return callback(new Error(`An error occurred: ${err}`));
});
}
async function login(userNameOrEmail, password, callback) {
try {
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: userNameOrEmail,
password: password // Send plaintext over HTTPS; API verifies it
})
};
const response = await fetch(apiEndpoint, options);
if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}
const result = await response.json();
if (result.err) {
return callback(new Error(`Error authenticating user: ${result.err}`));
}
const profile = {
email: result.profileData.email,
username: result.profileData.username
};
return callback(null, profile);
} catch (err) {
return callback(err);
}
}

Comment on lines +82 to +111
async function login(userNameOrEmail, password, callback) {
const hashedPassword = hash(password);
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
body: {
email: userNameOrEmail,
password: hashedPassword
}
};

const response = await fetch(apiEndpoint, options);

if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}

const result = response.json();

if (result.err) {
return callback(new Error(`Error authenticating user: ${err}`));
}

let profile = {
email: response.profileData.email,
username: response.profileData.username
};

return callback(null, profile);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async function login(userNameOrEmail, password, callback) {
const hashedPassword = hash(password);
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
body: {
email: userNameOrEmail,
password: hashedPassword
}
};
const response = await fetch(apiEndpoint, options);
if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}
const result = response.json();
if (result.err) {
return callback(new Error(`Error authenticating user: ${err}`));
}
let profile = {
email: response.profileData.email,
username: response.profileData.username
};
return callback(null, profile);
}
⏺ async function login(userNameOrEmail, password, callback) {
try {
const apiEndpoint = 'https://example.com/api/authenticate';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: userNameOrEmail,
password: password
})
};
const response = await fetch(apiEndpoint, options);
if (!response.ok) {
return callback(new Error(`HTTP error! Status: ${response.status}`));
}
const result = await response.json();
if (result.err) {
return callback(new Error(`Error authenticating user: ${result.err}`));
}
const profile = {
email: result.profileData.email,
username: result.profileData.username
};
return callback(null, profile);
} catch (err) {
return callback(err);
}
}


You can use the `global` object to define information or functions used across all action scripts that run in the container instance or cache expensive resources, like storing an <Tooltip tip="Access Token: Authorization credential, in the form of an opaque string or JWT, used to access an API." cta="View Glossary" href="/docs/glossary?term=Access+Token">Access Token</Tooltip> for a third-party (logging) API or your own API defined in Auth0 and obtained via the [Client Credentials Flow](/docs/get-started/authentication-and-authorization-flow/client-credentials-flow).

<Warning>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Warning>
<Callout icon="file-lines" color="#0EA5E9" iconType="regular">


<Warning>
Do not store user-specific information the `global` object. Because there is no container affinity for action script execution in Auth0, action scripts may execute in any running container instance or in a new container instance added to the pool.
</Warning>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</Warning>
</Callout>

Comment on lines +25 to 27
5. Under the **Machine-to-Machine Applications** tab, use the toggle to authorize your test application.

7. Select the drop-down menu to enable the following Auth0 Management API scopes:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing step 6


The Change Email script implements the defined function when a user's email address or their email address verification status changes. We recommend naming this function `changeEmail`.

The script is only used in a [legacy authentication scenario](/docs/authenticate/database-connections/custom-db/overview-custom-db-connections), and is required if you want to update a user's email address (and/or email address verification status) in Auth0 and your external database in the same operation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Should we clean this up now that it's redirecting?

### SQL Server

```javascript lines expandable
```javascript SQL Sever lines expandable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```javascript SQL Sever lines expandable
```javascript SQL Server lines expandable

callback(null, true);
```

<Warning>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Warning>
<Callout icon="file-lines" color="#0EA5E9" iconType="regular">


To update the `email_verified` attribute in the user's Auth0 profile, you must include the `email_verified` attribute and its value in the user profile object returned in the [Login](/docs/authenticate/database-connections/custom-db/templates/login) and [Get User](/docs/authenticate/database-connections/custom-db/templates/get-user) scripts.

</Warning>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</Warning>
</Callout>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants