li{list-style-type:disc;}.css-light-151tvvp ol>li{list-style-type:number;}.css-light-151tvvp ul>li,.css-light-151tvvp ol>li{font-size:1rem;margin:8px 0px;}.css-light-151tvvp .tablew{overflow-x:auto;scroll-behavior:smooth;webkit-overflow-scrolling:touch;}.css-light-151tvvp .table{font-size:0.875rem;letter-spacing:0.15px;border-collapse:collapse;}@media (max-width:823.95px){.css-light-151tvvp .table th{white-space:nowrap;}}.css-light-151tvvp .table tr>td,.css-light-151tvvp .table tr>th{line-height:1.25rem;padding:8px;vertical-align:top;border-top:1px solid #E8E8E8;}.css-light-151tvvp .table th{text-align:left;}.css-light-151tvvp .table>thead>tr>th{border-bottom:2px solid #E8E8E8;border-top:none;}.css-light-151tvvp .table>tbody>tr:nth-child(odd){background:#F6F6F6;}.css-light-151tvvp .panel{background-color:inherit;}.css-light-151tvvp .aside-container{padding:32px;border-radius:24px;border:1px solid #E8E8E8;}.css-light-151tvvp .aside-container .aside-heading{margin-bottom:12px;}.css-light-151tvvp .aside-container .aside-heading h4{margin-top:0;margin-bottom:0;}.css-light-151tvvp .aside-container .aside-body ul{padding-left:24px;}.css-light-151tvvp code:not(.code-highlight-prism),.css-light-151tvvp p>code{font-family:Roboto Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-size:0.875rem;line-height:1.25rem;letter-spacing:0.15px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;padding:0px 6px 2px;border-radius:3px;}.css-light-151tvvp code small,.css-light-151tvvp p>code small{font-family:Roboto Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-size:0.75rem;line-height:1.125rem;letter-spacing:0.25px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;}.css-light-151tvvp .code-picker .languages-bar .dropdown .dropdown-menu{background:#FFFFFF;list-style:none;padding-left:24px;}.css-light-151tvvp .code-picker .languages-bar>ul li{list-style-type:none;}.css-light-151tvvp .code-picker .languages-bar>ul>li.active>a{color:#263588;}.css-light-151tvvp .connections-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-flex-wrap:wrap;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}.css-light-151tvvp .connections-container:after{content:none;-webkit-flex:auto;-ms-flex:auto;flex:auto;}.css-light-151tvvp .connection{padding:24px 16px;border:1px solid #E8E8E8;-webkit-flex-basis:23%;-ms-flex-preferred-size:23%;flex-basis:23%;margin-bottom:16px;margin-right:2.6666666%;overflow:hidden;-webkit-transition:-webkit-transform 0.2s,border 0.2s;transition:transform 0.2s,border 0.2s;}.css-light-151tvvp .connection:nth-child(4n){margin-right:0;}.css-light-151tvvp .connection.connection-public:hover{border:1px solid #E8E8E8;box-shadow:0px 2px 4px rgb(0 0 0 / 12%);-webkit-transform:scale(1.02);-moz-transform:scale(1.02);-ms-transform:scale(1.02);transform:scale(1.02);-webkit-text-decoration:none;text-decoration:none;}.css-light-151tvvp .connection.connection-public:focus{box-shadow:rgba(63, 89, 228, 0.25) 0px 0px 0px 0.25em;}@media (max-width:599.95px){.css-light-151tvvp .connection{-webkit-flex-basis:48%;-ms-flex-preferred-size:48%;flex-basis:48%;margin-right:4%;}.css-light-151tvvp .connection:nth-child(2n){margin-right:0;}}.css-light-151tvvp .connection-content{text-align:center;}.css-light-151tvvp .connection-title{font-size:1.125rem;line-height:1.25rem;margin-top:16px;margin-bottom:0;}.css-light-151tvvp .connection-image-wrap{display:inline-block;vertical-align:middle;}.css-light-151tvvp .connection-image-wrap img{max-height:60px;max-width:60px;}.css-light-151tvvp .title-portal-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:baseline;-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;gap:4px;-webkit-transform:translateX(-20px);-moz-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);}.css-light-151tvvp .title-portal-container:hover{cursor:pointer;}.css-light-151tvvp .title-portal-container:hover .title-portal-icon{opacity:1;}.css-light-151tvvp .title-portal-container .title-portal-icon{color:#686868;opacity:0;}.css-light-151tvvp .title-portal-container .title-portal-text{margin-top:24px;scroll-margin-top:88px;}.css-light-151tvvp .title-portal-container h2.title-portal-text{margin-top:40px;margin-bottom:8px;}.css-light-151tvvp .tooltip-portal-underlined-word{font-style:normal;border-bottom:1px dotted #686868;}.css-light-151tvvp .alert-content>p{font-family:Inter Var,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Helvetica,Arial,sans-serif;font-weight:400;font-size:0.875rem;line-height:1.57143;letter-spacing:0;}.css-light-151tvvp .alert-content bold,.css-light-151tvvp .alert-content strong{font-weight:500;}.css-light-151tvvp .alert-content>p>a{font-weight:500;color:#191919;}.css-light-151tvvp .alert-content>p>a:hover{-webkit-text-decoration:none;text-decoration:none;}.css-light-151tvvp code .alert-content{font-family:Roboto Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-size:0.875rem;line-height:1.25rem;letter-spacing:0.15px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;}.css-light-151tvvp .QuantumAlert-standardWarning,.css-light-151tvvp .alert-portal-severity-warning{background-color:#FEF2B3;}.css-light-151tvvp .QuantumAlert-standardWarning $icon,.css-light-151tvvp .alert-portal-severity-warning $icon{color:#786713;}.css-light-151tvvp .QuantumAlert-standardInfo,.css-light-151tvvp .alert-portal-severity-info{background-color:#EEF0FD;}.css-light-151tvvp .QuantumAlert-standardInfo $icon,.css-light-151tvvp .alert-portal-severity-info $icon{color:#3F59E4;}.css-light-151tvvp .alert-portal-content:last-child{margin-bottom:0;}.css-light-151tvvp .alert-portal-content p{font-family:Inter Var,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Helvetica,Arial,sans-serif;font-weight:400;font-size:0.875rem;line-height:1.57143;letter-spacing:0;}.css-light-151tvvp .alert-portal-content p:last-child{margin-bottom:0;}.css-light-151tvvp .alert-portal-content code{font-family:Roboto Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-size:0.875rem;line-height:1.25rem;letter-spacing:0.15px;font-weight:400;-webkit-font-smoothing:subpixel-antialiased;padding-left:3px;padding-right:3px;}.css-light-151tvvp .alert-portal-content bold,.css-light-151tvvp .alert-portal-content strong,.css-light-151tvvp .alert-portal-content b{font-weight:500;font-size:0.875rem;}.css-light-151tvvp .MuiTabs-flexContainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.css-light-151tvvp .MuiTab-root{margin-left:0;margin-right:16px;font-family:Inter,fakt-web,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';padding:6px 12px;overflow:hidden;position:relative;font-size:0.875rem;max-width:264px;min-width:unset;box-sizing:border-box;min-height:48px;text-align:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;font-weight:400;line-height:1.71429;white-space:normal;padding-left:0;padding-right:0;letter-spacing:0.01071em;text-transform:none;}.css-light-151tvvp .MuiTab-root .MuiTab-root:first-child{margin-left:0;}.css-light-151tvvp .MuiTabs-scroller{-webkit-flex:1 1 auto;-ms-flex:1 1 auto;flex:1 1 auto;display:inline-block;position:relative;white-space:nowrap;border-bottom:1px solid #E8E8E8;width:100%;}.css-light-151tvvp .MuiTab-textColorPrimary.Mui-selected{border-bottom:1px solid #263588;}.css-light-151tvvp .MuiTab-wrapper{width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}.css-light-151tvvp .MuiTab-labelIcon{min-height:72px;padding-top:8px;}.css-light-151tvvp .MuiTab-labelIcon .MuiTab-wrapper>*:first-child{margin-bottom:8px;}.css-light-151tvvp .MuiTab-textColorInherit{color:inherit;opacity:0.7;}.css-light-151tvvp .MuiTab-textColorInherit.Mui-selected{opacity:1;}.css-light-151tvvp .MuiTab-textColorInherit.Mui-disabled{opacity:0.5;}.css-light-151tvvp .MuiTab-textColorPrimary{color:#65676e;font-weight:400;}.css-light-151tvvp .MuiTab-textColorPrimary.Mui-disabled{color:#65676e;}.css-light-151tvvp .MuiTab-fullWidth{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;max-width:none;-webkit-flex-basis:0;-ms-flex-preferred-size:0;flex-basis:0;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}.css-light-151tvvp .MuiTab-wrapped{font-size:0.75rem;line-height:1.5;}.css-light-151tvvp div[role=tabpanel] ol{list-style:inherit;padding-left:24px;}.css-light-151tvvp .MuiExpansionPanelSummary-content{margin:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-transition:margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-light-151tvvp .MuiExpansionPanelSummary-content [data-cosmos-key="avatar-block"]{height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.css-light-151tvvp .MuiExpansionPanel-root{margin:0;padding:32px;position:relative;-webkit-transition:margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:margin 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-light-151tvvp .MuiCollapse-hidden{visibility:hidden;}.css-light-151tvvp .MuiExpansionPanelSummary-expandIcon{width:25px;height:25px;-webkit-align-self:baseline;-ms-flex-item-align:baseline;align-self:baseline;}.css-light-151tvvp .MuiCollapse-root{height:0;transition-duration:268ms;min-height:0px;}.css-light-151tvvp .accordion-control-buttons{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0 0 8px auto;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:5px;}.css-light-151tvvp .accordion-panels{box-shadow:none;display:grid;gap:16px;grid-template-columns:minmax(0px, 1fr);}.css-light-151tvvp .accordion-panel{border:1px solid #E8E8E8;padding:16px;border-radius:8px;box-shadow:none;}.css-light-151tvvp #accordion-summary{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:0;min-hheight:unset;-webkit-transition:min-height 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:min-height 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.css-light-151tvvp .accordion-numbered-icon{width:2rem;height:2rem;font-size:0.875rem;color:#635dff;background-color:#e9e8ff;border-radius:50%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;overflow:hidden;position:relative;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-weight:500;text-transform:uppercase;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}.css-light-151tvvp .accordion-details{margin-top:16px;margin-left:0;margin-right:16px;}.css-light-151tvvp .accordion-numbered-details{margin-top:16px;margin-left:48px;margin-right:16px;}.css-light-qw3jjx{display:grid;grid-template-columns:minmax(0, 1fr);gap:24px;border:1px solid #E8E8E8;border-radius:4px;margin:32px 0px 40px;padding:40px;}.css-light-rk293q{padding-left:0;margin-left:8px;max-width:292px;font-weight:400;padding:8px;font-family:Inter Var,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Helvetica,Arial,sans-serif;font-size:0.75rem;line-height:1.4rem;letter-spacing:0em;color:#686868;padding-top:4px;padding-bottom:4px;border-radius:4px;-webkit-text-decoration:none;text-decoration:none;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;background:transparent;border:none;-webkit-transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;--identicons-color-light:#D7D7D7;--identicons-color-base:#B9B9B9;--identicons-color-dark:#686868;}.css-light-rk293q .QuantumSidebarLink-title{color:#3F59E4;}.css-light-rk293q:focus{box-shadow:none;}.css-light-rk293q .QuantumSidebarLink-startIcon{font-size:1rem;}.css-light-rk293q:hover{color:#3F59E4;-webkit-text-decoration:none;text-decoration:none;--identicons-color-light:#CFD6F8;--identicons-color-base:#AAB6F3;--identicons-color-dark:#3F59E4;}.css-light-rk293q:focus-visible{outline:none;box-shadow:rgba(63, 89, 228, 0.25) 0px 0px 0px 0.25em;}
Skip to main content Manage Users
Manage Access
Docs Manage Users User Migration Configure Automatic Migration from Your Database
Configure Automatic Migration from Your Database Configure your Database connection to automatically migrate your users from an external user store to Auth0 with custom database action scripts .
If you try to use more than one migration method (for example, automatic migration then bulk user import), you may encounter a DUPLICATED_USER
error. This error indicates that the user exists in Auth0's internal user store but not in your tenant. To correct this error, delete the user with the Auth0 Management API Delete a Connection User endpoint and then re-attempt the import.
Configure Database connection as custom Create a Database connection, and then set it to custom.
Go to Auth0 Dashboard > Authentication > Database and select the database to view.
Select the Custom Database view, and toggle on Use my own database .
Select the Settings view, toggle on Import Users to Auth0 , and select Save .
Configure Database Action Scripts Select the Custom Database view, and then locate Database Action Scripts .
The Login script executes each time a user who is not found in the Auth0 attempts to log in. It verifies that the user exists in the external user store without reprompting the user for their password.
The Get User script executes after any of the following scenarios:
A user initiates signup attempt.
A user initiates a change password flow.
A user enters their email address when using Identifier First + Biometrics.
The Management API Update a User's Email or Username or Create User endpoint is called.
If a user who has not been migrated confirms a password change, their user profile will be created in the Auth0 with the new password. This user profile contains all the data returned in the Get User script. All subsequent logins for this user will be performed directly in Auth0.
Verify user migration is complete Verify that all users have been migrated to the Auth0 user store using the Auth0 Dashboard or the Auth0 Management API.
Go to Auth0 Dashboard > User Management > Users , and review the list of users.
Use the Management API List or Search Users endpoint.
Disconnect external user store Reconfigure the Database Action Scripts as no operation functions. This will prevent Auth0 from reaching out to your external user store to authenticate users.
Make sure to leave the Import Users to Auth0 option turned on. If you turn this option off Auth0 will only use the scripts to authenticate and perform other user actions instead of using the users that were imported locally.
Go to Auth0 Dashboard > Authentication > Database , and then select your Database connection.
Switch to the Custom Database view, and then locate Database Action Scripts.
Update the Login script.
function login (email, password, callback) {
return callback(null, null);
}
Update the Get User script.
function getByEmail (email, callback) {
return callback(null, null);
}
Troubleshoot user migration issues If you encounter any issues with automatic migration, first read Custom Database Connection and Action Script Best Practices .
The most common scenarios when you may encounter this issue:
You delete a user from your Database connection and then try to recreate the user.
You attempt to create a new user on your Database connection when the user already exists in your external user store.
A user's migration process was interrupted.
During the user migration process, Auth0 first creates a partial user profile in an internal user store, and then creates a full user profile on your Database connection. If an issue occurs that prevents this full user profile from being created, you may encounter the The user already exists
error.
You can usually resolve this issue by deleting the user from the Database connection, deleting the user from the internal user store, and then reattempting the migration process.
Check the console.log()
statements with the Real-time Webtask Logs extension .
Delete the user with the Management API Delete a User endpoint.
Delete the user with the Management API Delete a Connection User endpoint.
Instruct the user to log in or change their password to reattempt migration.
If a user is interrupted during the login or change password flow that initiates the migration process, Auth0 may not be able to transfer their metadata (user_metadata
or app_metadata
) along with their other profile data.
You can mitigate this scenario by creating an Action that verifies the user's profile is missing metadata, retrieves it from the external use store, and then stores it in Auth0.
Was this article helpful?