{
    "componentChunkName": "component---src-pages-blog-markdown-remark-fields-slug-js",
    "path": "/blog/migrate-from-auth0",
    "result": {"data":{"markdownRemark":{"html":"<p>Authentication systems form the security foundation of modern applications. Migrating from <a href=\"https://auth0.com/\" target=\"_blank\" rel=\"nofollow\">Auth0</a> to <a href=\"https://supertokens.com/\" target=\"_blank\" rel=\"nofollow\">SuperTokens</a> involves transferring user credentials, preserving session state, and maintaining service continuity, while users remain unaware of backend changes. Whether driven by cost optimization, control requirements, or feature needs, successful migration demands careful planning and execution.</p>\n<p>This guide provides developers with practical strategies for Auth0-to-SuperTokens migration, covering user export procedures, migration pattern selection, implementation details, and common challenges.</p>\n<h2 id=\"choosing-the-right-migration-strategy\" style=\"position:relative;\"><a href=\"#choosing-the-right-migration-strategy\" aria-label=\"choosing the right migration strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Choosing the Right Migration Strategy</h2>\n<p>Your migration strategy needs to balance user disruption, engineering effort, and timeline constraints. Four primary approaches exist, each with distinct trade-offs regarding complexity, user impact, and migration completeness.</p>\n<h3 id=\"what-are-your-auth0-migration-options\" style=\"position:relative;\"><a href=\"#what-are-your-auth0-migration-options\" aria-label=\"what are your auth0 migration options permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>What Are Your Auth0 Migration Options?</strong></h3>\n<ul>\n<li><strong>Lazy Migration</strong> transfers users individually upon their next login attempt. The authentication system checks SuperTokens first; and if the user doesn’t exist, it authenticates against Auth0, imports the user to SuperTokens, and issues a new session. This gradual approach minimizes risk and distributes the load over time.</li>\n<li><strong>Trickle Migration</strong> triggers user transfers during specific events, such as logins, profile updates, password changes, or API usage. It’s similar to lazy migration, but extends beyond authentication events to capture users through various interaction points. This accelerates migration for active users while maintaining a gradual rollout.</li>\n<li><strong>Automatic Migration</strong> proactively transfers users by using Auth0 webhooks, rules, or scheduled jobs. Rather than waiting for user-initiated events, automated scripts move users in batches. This requires capturing credentials during Auth0 authentication, preserve password-based login.</li>\n<li><strong>Full Export and Re-Import</strong> exports all users from Auth0 and imports them into SuperTokens in bulk operations. This is the fastest migration path, but it requires maintenance windows and coordination to avoid authentication failures during the transition.</li>\n</ul>\n<p>Each strategy suits different scenarios. Small active user bases benefit from the simplicity of lazy migration. Large inactive user populations may require automatic migration to ensure completeness. Enterprise applications with strict SLAs often choose full export to control cutover timing precisely.</p>\n<h3 id=\"lazy-migration-explained\" style=\"position:relative;\"><a href=\"#lazy-migration-explained\" aria-label=\"lazy migration explained permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Lazy Migration Explained</strong></h3>\n<p>Lazy migration implements a fallback authentication pattern where SuperTokens becomes the primary source, while Auth0 serves as a backup for unmigrated users.</p>\n<ul>\n<li><strong>Flow:</strong> User submits credentials → application checks SuperTokens → if the user is not found, authenticate against Auth0 → on success, create user in SuperTokens with metadata → issue SuperTokens session. Subsequent logins go directly to SuperTokens.</li>\n<li><strong>Advantages:</strong> Zero downtime with both systems running in parallel, users notice nothing, active users migrate automatically, and easy rollback by disabling fallback logic.</li>\n<li><strong>Considerations:</strong> Requires maintaining both systems during transition, inactive users may never migrate without eventual bulk import, and password hashes typically can’t be transferred initially.</li>\n</ul>\n<h3 id=\"trickle-migration-explained\" style=\"position:relative;\"><a href=\"#trickle-migration-explained\" aria-label=\"trickle migration explained permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Trickle Migration Explained</strong></h3>\n<p>Trickle migration extends the lazy approach by triggering imports across more events: login attempts, profile updates, password reset requests, OAuth token refreshes, and session extensions.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"99616740302889780000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`async function migrateUserIfNeeded(userId, triggerEvent) {\n  // Check if user exists in SuperTokens\n  const stUser = await SuperTokens.getUserById(userId);\n \n  if (!stUser) {\n    // User not yet migrated - fetch from Auth0\n    const auth0User = await auth0.getUser(userId);\n   \n    // Import to SuperTokens\n    await SuperTokens.importUser({\n      userId: auth0User.user_id,\n      email: auth0User.email,\n      emailVerified: auth0User.email_verified,\n      metadata: auth0User.user_metadata,\n      appMetadata: auth0User.app_metadata,\n    });\n   \n    logMigrationEvent(userId, triggerEvent);\n  }\n \n  return stUser || await SuperTokens.getUserById(userId);\n}`, `99616740302889780000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">migrateUserIfNeeded</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">userId<span class=\"token punctuation\">,</span> triggerEvent</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token comment\">// Check if user exists in SuperTokens</span>\n  <span class=\"token keyword\">const</span> stUser <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> SuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">getUserById</span><span class=\"token punctuation\">(</span>userId<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>stUser<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// User not yet migrated - fetch from Auth0</span>\n    <span class=\"token keyword\">const</span> auth0User <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0<span class=\"token punctuation\">.</span><span class=\"token function\">getUser</span><span class=\"token punctuation\">(</span>userId<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n   \n    <span class=\"token comment\">// Import to SuperTokens</span>\n    <span class=\"token keyword\">await</span> SuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">importUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">userId</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">emailVerified</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>email_verified<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">metadata</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>user_metadata<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">appMetadata</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>app_metadata<span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n   \n    <span class=\"token function\">logMigrationEvent</span><span class=\"token punctuation\">(</span>userId<span class=\"token punctuation\">,</span> triggerEvent<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n \n  <span class=\"token keyword\">return</span> stUser <span class=\"token operator\">||</span> <span class=\"token keyword\">await</span> SuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">getUserById</span><span class=\"token punctuation\">(</span>userId<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Advantages:</strong> Faster migration than a lazy migration, multiple touchpoints capture more users, maintains gradual rollout safety, and it is transparent to users.</p>\n<p><strong>Considerations:</strong> More integration points increase code complexity, must handle migration failures gracefully across multiple flows, and it still requires eventual bulk import for completely inactive users.</p>\n<h3 id=\"automatic-migration-explained\" style=\"position:relative;\"><a href=\"#automatic-migration-explained\" aria-label=\"automatic migration explained permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Automatic Migration Explained</strong></h3>\n<p>Automatic migration proactively transfers users by using Auth0’s extensibility mechanisms, combined with scheduled batch jobs.</p>\n<p><strong>Auth0 Rules-Based Migration:</strong> Rules execute during authentication and can capture plaintext credentials before hashing, and forward them to SuperTokens:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"48127058636310170000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`function migrateToSuperTokens(user, context, callback) {\n  if (user.app_metadata && user.app_metadata.migrated_to_supertokens) {\n    return callback(null, user, context);\n  }\n\n\n  request.post({\n    url: 'https://your-api.com/migrate-user',\n    json: {\n      userId: user.user_id,\n      email: user.email,\n      password: context.request.body.password,\n      metadata: user.user_metadata,\n    },\n  }, function(err, response, body) {\n    if (!err && response.statusCode === 200) {\n      user.app_metadata = user.app_metadata || {};\n      user.app_metadata.migrated_to_supertokens = true;\n      auth0.users.updateAppMetadata(user.user_id, user.app_metadata);\n    }\n    callback(null, user, context);\n  });\n}`, `48127058636310170000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">function</span> <span class=\"token function\">migrateToSuperTokens</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">user<span class=\"token punctuation\">,</span> context<span class=\"token punctuation\">,</span> callback</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>app_metadata <span class=\"token operator\">&amp;&amp;</span> user<span class=\"token punctuation\">.</span>app_metadata<span class=\"token punctuation\">.</span>migrated_to_supertokens<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token function\">callback</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">null</span><span class=\"token punctuation\">,</span> user<span class=\"token punctuation\">,</span> context<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n\n\n  request<span class=\"token punctuation\">.</span><span class=\"token function\">post</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">url</span><span class=\"token operator\">:</span> <span class=\"token string\">'https://your-api.com/migrate-user'</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">json</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">userId</span><span class=\"token operator\">:</span> user<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> user<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">password</span><span class=\"token operator\">:</span> context<span class=\"token punctuation\">.</span>request<span class=\"token punctuation\">.</span>body<span class=\"token punctuation\">.</span>password<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">metadata</span><span class=\"token operator\">:</span> user<span class=\"token punctuation\">.</span>user_metadata<span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">err<span class=\"token punctuation\">,</span> response<span class=\"token punctuation\">,</span> body</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span><span class=\"token operator\">!</span>err <span class=\"token operator\">&amp;&amp;</span> response<span class=\"token punctuation\">.</span>statusCode <span class=\"token operator\">===</span> <span class=\"token number\">200</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      user<span class=\"token punctuation\">.</span>app_metadata <span class=\"token operator\">=</span> user<span class=\"token punctuation\">.</span>app_metadata <span class=\"token operator\">||</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n      user<span class=\"token punctuation\">.</span>app_metadata<span class=\"token punctuation\">.</span>migrated_to_supertokens <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">;</span>\n      auth0<span class=\"token punctuation\">.</span>users<span class=\"token punctuation\">.</span><span class=\"token function\">updateAppMetadata</span><span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span> user<span class=\"token punctuation\">.</span>app_metadata<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n    <span class=\"token function\">callback</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">null</span><span class=\"token punctuation\">,</span> user<span class=\"token punctuation\">,</span> context<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>For users who haven’t logged in recently, scheduled batch jobs handle the remainder — though password hashes are typically unavailable, meaning those users must reset passwords on their first SuperTokens login.</p>\n<p><strong>Advantages:</strong> Proactive migration independent of user activity, predictable, controllable timeline, and it captures inactive users.</p>\n<p><strong>Considerations:</strong> Password capture only works during authentication events, Auth0 API rate limits constrain batch speed, and it requires careful credential handling.</p>\n<h3 id=\"full-export-and-re-import-explained\" style=\"position:relative;\"><a href=\"#full-export-and-re-import-explained\" aria-label=\"full export and re import explained permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Full Export and Re-Import Explained</strong></h3>\n<p>Full export and re-import executes a coordinated bulk transfer during a planned cutover window: export the complete user database, transform the data, bulk import to SuperTokens in batches of 1,000—10,000, update application configuration, monitor traffic, and send password reset emails if needed.</p>\n<p><strong>Advantages:</strong> Fastest path to complete migration, predictable timeline measured in hours or days rather than weeks, no dual-system complexity, and it captures inactive users immediately.</p>\n<p><strong>Considerations:</strong> Requires a maintenance window, users typically must reset passwords, higher risk since a single event impacts everyone, and rollback is complex after cutover.</p>\n<p>This approach works best for organizations that can schedule downtime, need rapid Auth0 cost elimination, or have large inactive user bases that lazy migration wouldn’t efficiently capture.</p>\n<h2 id=\"how-to-export-users-from-auth0\" style=\"position:relative;\"><a href=\"#how-to-export-users-from-auth0\" aria-label=\"how to export users from auth0 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How to Export Users from Auth0</h2>\n<p>Auth0 provides multiple user export mechanisms, each with different capabilities regarding password hash access and metadata completeness.</p>\n<h3 id=\"using-auth0s-user-importexport-extension\" style=\"position:relative;\"><a href=\"#using-auth0s-user-importexport-extension\" aria-label=\"using auth0s user importexport extension permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Using Auth0’s User Import/Export Extension</strong></h3>\n<p>Auth0’s management dashboard includes user export functionality through the User Import/Export extension or the Management API.</p>\n<p><strong>Dashboard Export:</strong></p>\n<ol>\n<li>Navigate to Auth0 Dashboard → Users.</li>\n<li>Click “Export Users” (or install the User Import/Export extension if not available).</li>\n<li>Configure export parameters:\n<ul>\n<li>Connection type (database, social, enterprise)</li>\n<li>User fields to include</li>\n<li>Export format (JSON or CSV)</li>\n</ul>\n</li>\n<li>Initiate export job.</li>\n<li>Download the resulting file via email link or dashboard.</li>\n</ol>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 630px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/ce9b09b256bfa51e5f84261c0fc33092/29007/Import-Export-Extension.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 41.77215189873418%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA20lEQVQY06WNPU7DQBCFc/87cAFuQE1LBQ0SDVWcLI69Sbw7O78PZW2lgA4+PY2eRvNpdgCIaOiM4zhNU84ZvzAzImqNn57Lw+P59Z0B7ADUWodhn9LxcDikdEwpCfMP2d2YSUQ+PuXlre2TbbIaTrPN2aY+52zjib96xknmrEvxpUQllApTuMM9NtnMqYkZREM0SiERV4Na1MqqHgHVuN+whDvustVagFhzuZyZG4CIWyeqzBwRy7KISN+7d3v7fL0uRLQeMYuIRodZWuPW2q2LrLJ1NvnP/Ev+BqOJ0/jdXuq6AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Import Export Extension\"\n        title=\"Import Export Extension\"\n        src=\"/static/ce9b09b256bfa51e5f84261c0fc33092/f058b/Import-Export-Extension.png\"\n        srcset=\"/static/ce9b09b256bfa51e5f84261c0fc33092/c26ae/Import-Export-Extension.png 158w,\n/static/ce9b09b256bfa51e5f84261c0fc33092/6bdcf/Import-Export-Extension.png 315w,\n/static/ce9b09b256bfa51e5f84261c0fc33092/f058b/Import-Export-Extension.png 630w,\n/static/ce9b09b256bfa51e5f84261c0fc33092/40601/Import-Export-Extension.png 945w,\n/static/ce9b09b256bfa51e5f84261c0fc33092/78612/Import-Export-Extension.png 1260w,\n/static/ce9b09b256bfa51e5f84261c0fc33092/29007/Import-Export-Extension.png 1600w\"\n        sizes=\"(max-width: 630px) 100vw, 630px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p><strong>Management API Export:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"65797009144563016000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`const ManagementClient = require('auth0').ManagementClient;\n\nconst management = new ManagementClient({\n  domain: 'YOUR_DOMAIN.auth0.com',\n  clientId: 'YOUR_CLIENT_ID',\n  clientSecret: 'YOUR_CLIENT_SECRET',\n});\n\n\nasync function exportUsers() {\n  let users = [];\n  let page = 0;\n  const perPage = 100;\n \n  while (true) {\n    const batch = await management.getUsers({\n      per_page: perPage,\n      page: page,\n    });\n   \n    if (batch.length === 0) break;\n   \n    users = users.concat(batch);\n    page++;\n  }\n \n  return users;\n}`, `65797009144563016000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">const</span> ManagementClient <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'auth0'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>ManagementClient<span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">const</span> management <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">ManagementClient</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">domain</span><span class=\"token operator\">:</span> <span class=\"token string\">'YOUR_DOMAIN.auth0.com'</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">clientId</span><span class=\"token operator\">:</span> <span class=\"token string\">'YOUR_CLIENT_ID'</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">clientSecret</span><span class=\"token operator\">:</span> <span class=\"token string\">'YOUR_CLIENT_SECRET'</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n\n<span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">exportUsers</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">let</span> users <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">let</span> page <span class=\"token operator\">=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">const</span> perPage <span class=\"token operator\">=</span> <span class=\"token number\">100</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token keyword\">while</span> <span class=\"token punctuation\">(</span><span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">const</span> batch <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> management<span class=\"token punctuation\">.</span><span class=\"token function\">getUsers</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">per_page</span><span class=\"token operator\">:</span> perPage<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">page</span><span class=\"token operator\">:</span> page<span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n   \n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>batch<span class=\"token punctuation\">.</span>length <span class=\"token operator\">===</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">break</span><span class=\"token punctuation\">;</span>\n   \n    users <span class=\"token operator\">=</span> users<span class=\"token punctuation\">.</span><span class=\"token function\">concat</span><span class=\"token punctuation\">(</span>batch<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    page<span class=\"token operator\">++</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n \n  <span class=\"token keyword\">return</span> users<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Required Permissions:</strong></p>\n<ul>\n<li><code class=\"language-text\">read:users</code> scope for basic user data.</li>\n<li><code class=\"language-text\">read:user_idp_tokens</code> for social connection tokens.</li>\n<li>Application must be authorized for the Management API.</li>\n</ul>\n<p>Exports include user identifiers, email addresses, metadata, and profile information, but typically exclude password hashes for security reasons.</p>\n<h3 id=\"can-you-export-users-with-passwords\" style=\"position:relative;\"><a href=\"#can-you-export-users-with-passwords\" aria-label=\"can you export users with passwords permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Can You Export Users With Passwords?</strong></h3>\n<p>Auth0 stores password hashes in a secure internal storage inaccessible via standard APIs. If password migration is required, Auth0’s Custom Database feature with “migration mode” enabled captures credentials progressively as users authenticate — create a Custom Database connection, implement a login script that verifies against SuperTokens with an Auth0 fallback, and then enable “Import Users to Auth0.” Passwords transfer automatically as users log in.</p>\n<p>If that’s not feasible, the simpler alternative is forcing password resets: export users without passwords, import to SuperTokens, and send reset emails during migration. Note that the password hash algorithm (bcrypt, scrypt, PBKDF2) must match between systems for any direct hash import, mismatches require resets regardless.</p>\n<h3 id=\"secure-user-export-tips\" style=\"position:relative;\"><a href=\"#secure-user-export-tips\" aria-label=\"secure user export tips permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Secure User Export Tips</strong></h3>\n<p>User exports contain sensitive personal information and should be treated as critical security artifacts throughout the migration process.Use HTTPS exclusively for all API calls, store export files in encrypted storage with automatic expiration, restrict filesystem permissions to migration service accounts, never commit export files to version control, and delete files immediately after successful import. Limit export access to the minimum required personnel, use short-lived API tokens, and require MFA for export initiation. Export only the fields needed, anonymize PII where possible, and document all operations for GDPR/CCPA audit trails.</p>\n<h2 id=\"implementing-supertokens-after-auth0\" style=\"position:relative;\"><a href=\"#implementing-supertokens-after-auth0\" aria-label=\"implementing supertokens after auth0 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementing SuperTokens After Auth0</h2>\n<p>Successful migration requires proper SuperTokens configuration that matches your application architecture and security requirements.</p>\n<h3 id=\"supertokens-setup-essentials\" style=\"position:relative;\"><a href=\"#supertokens-setup-essentials\" aria-label=\"supertokens setup essentials permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>SuperTokens Setup Essentials</strong></h3>\n<p>SuperTokens offers two deployment options: self-hosted or managed cloud service. Selection depends on infrastructure preferences, compliance requirements, and operational capacity.</p>\n<p><strong>Managed Service Setup:</strong></p>\n<ol>\n<li>Create an account at supertokens.com.</li>\n<li>Obtain the connection URI and the API key from the dashboard.</li>\n<li>Configure the backend SDK with credentials.</li>\n<li>Deploy the frontend SDK in the application.</li>\n</ol>\n<p><strong>Self-Hosted Setup:</strong></p>\n<ol>\n<li>Deploy SuperTokens Core via Docker:</li>\n</ol>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"58748391509476350000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`docker run -p 3567:3567 -d registry.supertokens.io/supertokens/supertokens-postgresql`, `58748391509476350000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\">docker run <span class=\"token operator\">-</span>p <span class=\"token number\">3567</span><span class=\"token operator\">:</span><span class=\"token number\">3567</span> <span class=\"token operator\">-</span>d registry<span class=\"token punctuation\">.</span>supertokens<span class=\"token punctuation\">.</span>io<span class=\"token operator\">/</span>supertokens<span class=\"token operator\">/</span>supertokens<span class=\"token operator\">-</span>postgresql</code></pre></div>\n<ol start=\"2\">\n<li>Configure a PostgreSQL or MySQL database.</li>\n<li>Set environment variables for the database connection.</li>\n<li>Initialize the backend SDK to point to the self-hosted core.</li>\n</ol>\n<p><strong>Backend Configuration:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"64860970905048120000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import SuperTokens from &quot;supertokens-node&quot;;\nimport EmailPassword from &quot;supertokens-node/recipe/emailpassword&quot;;\nimport Session from &quot;supertokens-node/recipe/session&quot;;\n\n\nSuperTokens.init({\n  framework: &quot;express&quot;,\n  supertokens: {\n    connectionURI: &quot;https://your-instance.supertokens.io&quot;,\n    apiKey: &quot;your-api-key&quot;,\n  },\n  appInfo: {\n    appName: &quot;Your App&quot;,\n    apiDomain: &quot;https://api.yourapp.com&quot;,\n    websiteDomain: &quot;https://yourapp.com&quot;,\n    apiBasePath: &quot;/auth&quot;,\n    websiteBasePath: &quot;/auth&quot;,\n  },\n  recipeList: [\n    EmailPassword.init(),\n    Session.init(),\n  ],\n});`, `64860970905048120000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> SuperTokens <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> EmailPassword <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/emailpassword\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> Session <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/session\"</span><span class=\"token punctuation\">;</span>\n\n\nSuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">framework</span><span class=\"token operator\">:</span> <span class=\"token string\">\"express\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">supertokens</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">connectionURI</span><span class=\"token operator\">:</span> <span class=\"token string\">\"https://your-instance.supertokens.io\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">apiKey</span><span class=\"token operator\">:</span> <span class=\"token string\">\"your-api-key\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">appInfo</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">appName</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Your App\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">apiDomain</span><span class=\"token operator\">:</span> <span class=\"token string\">\"https://api.yourapp.com\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">websiteDomain</span><span class=\"token operator\">:</span> <span class=\"token string\">\"https://yourapp.com\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">apiBasePath</span><span class=\"token operator\">:</span> <span class=\"token string\">\"/auth\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">websiteBasePath</span><span class=\"token operator\">:</span> <span class=\"token string\">\"/auth\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">recipeList</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    Session<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p><strong>Frontend Configuration:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"43730895203307150000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import SuperTokens from &quot;supertokens-auth-react&quot;;\nimport EmailPassword from &quot;supertokens-auth-react/recipe/emailpassword&quot;;\nimport Session from &quot;supertokens-auth-react/recipe/session&quot;;\n\n\nSuperTokens.init({\n  appInfo: {\n    appName: &quot;Your App&quot;,\n    apiDomain: &quot;https://api.yourapp.com&quot;,\n    websiteDomain: &quot;https://yourapp.com&quot;,\n    apiBasePath: &quot;/auth&quot;,\n    websiteBasePath: &quot;/auth&quot;,\n  },\n  recipeList: [\n    EmailPassword.init(),\n    Session.init(),\n  ],\n});`, `43730895203307150000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> SuperTokens <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-auth-react\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> EmailPassword <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-auth-react/recipe/emailpassword\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> Session <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-auth-react/recipe/session\"</span><span class=\"token punctuation\">;</span>\n\n\nSuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">appInfo</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">appName</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Your App\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">apiDomain</span><span class=\"token operator\">:</span> <span class=\"token string\">\"https://api.yourapp.com\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">websiteDomain</span><span class=\"token operator\">:</span> <span class=\"token string\">\"https://yourapp.com\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">apiBasePath</span><span class=\"token operator\">:</span> <span class=\"token string\">\"/auth\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">websiteBasePath</span><span class=\"token operator\">:</span> <span class=\"token string\">\"/auth\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">recipeList</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    Session<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"importing-users-to-supertokens\" style=\"position:relative;\"><a href=\"#importing-users-to-supertokens\" aria-label=\"importing users to supertokens permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Importing Users to SuperTokens</strong></h3>\n<p>User import maps Auth0 data structures to SuperTokens schema while preserving essential authentication and profile information.</p>\n<p><strong>Field Mapping:</strong></p>\n<table>\n<thead>\n<tr>\n<th><strong>Auth0 Field</strong></th>\n<th><strong>SuperTokens Field</strong></th>\n<th><strong>Notes</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"language-text\">user_id</code></td>\n<td><code class=\"language-text\">externalUserId</code></td>\n<td>Preserves user identity</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">email</code></td>\n<td><code class=\"language-text\">email</code></td>\n<td>Primary identifier</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">email_verified</code></td>\n<td><code class=\"language-text\">isEmailVerified</code></td>\n<td>Email verification status</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">user_metadata</code></td>\n<td><code class=\"language-text\">userMetadata</code></td>\n<td>Custom user data</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">app_metadata</code></td>\n<td><code class=\"language-text\">userMetadata</code> or custom storage</td>\n<td>Application-specific data</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">created_at</code></td>\n<td><code class=\"language-text\">timeJoined</code></td>\n<td>Account creation timestamp</td>\n</tr>\n</tbody>\n</table>\n<p><strong>Import API Usage:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"15359722760776640000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import { createUser } from &quot;supertokens-node/recipe/emailpassword&quot;;\n\n\nasync function importAuth0User(auth0User) {\n  try {\n    const result = await createUser({\n      email: auth0User.email,\n      password: generateTemporaryPassword(), // If password unavailable\n    });\n   \n    // Store Auth0 ID for reference\n    await updateUserMetadata(result.user.id, {\n      auth0UserId: auth0User.user_id,\n      migratedAt: new Date().toISOString(),\n      ...auth0User.user_metadata,\n    });\n   \n    return result;\n  } catch (error) {\n    console.error(\\`Failed to import user \\${auth0User.email}:\\`, error);\n    throw error;\n  }\n}`, `15359722760776640000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> createUser <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/emailpassword\"</span><span class=\"token punctuation\">;</span>\n\n\n<span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">importAuth0User</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">auth0User</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">const</span> result <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">createUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">password</span><span class=\"token operator\">:</span> <span class=\"token function\">generateTemporaryPassword</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// If password unavailable</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n   \n    <span class=\"token comment\">// Store Auth0 ID for reference</span>\n    <span class=\"token keyword\">await</span> <span class=\"token function\">updateUserMetadata</span><span class=\"token punctuation\">(</span>result<span class=\"token punctuation\">.</span>user<span class=\"token punctuation\">.</span>id<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token literal-property property\">auth0UserId</span><span class=\"token operator\">:</span> auth0User<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n      <span class=\"token literal-property property\">migratedAt</span><span class=\"token operator\">:</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Date</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">toISOString</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n      <span class=\"token operator\">...</span>auth0User<span class=\"token punctuation\">.</span>user_metadata<span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n   \n    <span class=\"token keyword\">return</span> result<span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    console<span class=\"token punctuation\">.</span><span class=\"token function\">error</span><span class=\"token punctuation\">(</span><span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">Failed to import user </span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span>auth0User<span class=\"token punctuation\">.</span>email<span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token string\">:</span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">,</span> error<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">throw</span> error<span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Lazy Migration Import:</strong></p>\n<p>For lazy migration, import happens during authentication:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"24692827071666420000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`app.post(&quot;/auth/signin-with-migration&quot;, async (req, res) => {\n  const { email, password } = req.body;\n \n  // Try SuperTokens first\n  try {\n    const session = await EmailPassword.signIn(email, password);\n    return res.json({ status: &quot;OK&quot;, session });\n  } catch (stError) {\n    // User not in SuperTokens - check Auth0\n    try {\n      const auth0Session = await auth0.authenticate(email, password);\n     \n      // Import to SuperTokens\n      await createUser({\n        email: email,\n        password: password, // Password captured during auth\n      });\n     \n      // Create SuperTokens session\n      const session = await EmailPassword.signIn(email, password);\n      return res.json({ status: &quot;OK&quot;, session, migrated: true });\n    } catch (auth0Error) {\n      return res.status(401).json({ error: &quot;Invalid credentials&quot; });\n    }\n  }\n});`, `24692827071666420000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\">app<span class=\"token punctuation\">.</span><span class=\"token function\">post</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"/auth/signin-with-migration\"</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">req<span class=\"token punctuation\">,</span> res</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> <span class=\"token punctuation\">{</span> email<span class=\"token punctuation\">,</span> password <span class=\"token punctuation\">}</span> <span class=\"token operator\">=</span> req<span class=\"token punctuation\">.</span>body<span class=\"token punctuation\">;</span>\n \n  <span class=\"token comment\">// Try SuperTokens first</span>\n  <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">const</span> session <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">signIn</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">return</span> res<span class=\"token punctuation\">.</span><span class=\"token function\">json</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span> <span class=\"token literal-property property\">status</span><span class=\"token operator\">:</span> <span class=\"token string\">\"OK\"</span><span class=\"token punctuation\">,</span> session <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>stError<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// User not in SuperTokens - check Auth0</span>\n    <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">const</span> auth0Session <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0<span class=\"token punctuation\">.</span><span class=\"token function\">authenticate</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n     \n      <span class=\"token comment\">// Import to SuperTokens</span>\n      <span class=\"token keyword\">await</span> <span class=\"token function\">createUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n        <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> email<span class=\"token punctuation\">,</span>\n        <span class=\"token literal-property property\">password</span><span class=\"token operator\">:</span> password<span class=\"token punctuation\">,</span> <span class=\"token comment\">// Password captured during auth</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n     \n      <span class=\"token comment\">// Create SuperTokens session</span>\n      <span class=\"token keyword\">const</span> session <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">signIn</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token keyword\">return</span> res<span class=\"token punctuation\">.</span><span class=\"token function\">json</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span> <span class=\"token literal-property property\">status</span><span class=\"token operator\">:</span> <span class=\"token string\">\"OK\"</span><span class=\"token punctuation\">,</span> session<span class=\"token punctuation\">,</span> <span class=\"token literal-property property\">migrated</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>auth0Error<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">return</span> res<span class=\"token punctuation\">.</span><span class=\"token function\">status</span><span class=\"token punctuation\">(</span><span class=\"token number\">401</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">json</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span> <span class=\"token literal-property property\">error</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Invalid credentials\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"preserving-sessions-and-user-context\" style=\"position:relative;\"><a href=\"#preserving-sessions-and-user-context\" aria-label=\"preserving sessions and user context permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Preserving Sessions and User Context</strong></h3>\n<p>Session continuity during migration prevents forcing users to re-authenticate unnecessarily.</p>\n<p><strong>JWT Claims Mapping:</strong></p>\n<p>Auth0 access tokens contain claims that applications depend on. SuperTokens sessions must include equivalent claims:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"87094435401863630000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import Session from &quot;supertokens-node/recipe/session&quot;;\n\n\nSession.init({\n  override: {\n    functions: (originalImplementation) => ({\n      ...originalImplementation,\n      createNewSession: async (input) => {\n        // Fetch user roles and permissions\n        const userRoles = await getUserRoles(input.userId);\n        const permissions = await getUserPermissions(input.userId);\n       \n        // Add Auth0-compatible claims\n        input.accessTokenPayload = {\n          ...input.accessTokenPayload,\n          &quot;https://yourapp.com/roles&quot;: userRoles,\n          &quot;https://yourapp.com/permissions&quot;: permissions,\n          sub: input.userId,\n          email: input.userDataInJWT.email,\n        };\n       \n        return originalImplementation.createNewSession(input);\n      },\n    }),\n  },\n});`, `87094435401863630000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> Session <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/session\"</span><span class=\"token punctuation\">;</span>\n\n\nSession<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">override</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function-variable function\">functions</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">originalImplementation</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      <span class=\"token operator\">...</span>originalImplementation<span class=\"token punctuation\">,</span>\n      <span class=\"token function-variable function\">createNewSession</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">input</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n        <span class=\"token comment\">// Fetch user roles and permissions</span>\n        <span class=\"token keyword\">const</span> userRoles <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">getUserRoles</span><span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">.</span>userId<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n        <span class=\"token keyword\">const</span> permissions <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">getUserPermissions</span><span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">.</span>userId<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n       \n        <span class=\"token comment\">// Add Auth0-compatible claims</span>\n        input<span class=\"token punctuation\">.</span>accessTokenPayload <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n          <span class=\"token operator\">...</span>input<span class=\"token punctuation\">.</span>accessTokenPayload<span class=\"token punctuation\">,</span>\n          <span class=\"token string-property property\">\"https://yourapp.com/roles\"</span><span class=\"token operator\">:</span> userRoles<span class=\"token punctuation\">,</span>\n          <span class=\"token string-property property\">\"https://yourapp.com/permissions\"</span><span class=\"token operator\">:</span> permissions<span class=\"token punctuation\">,</span>\n          <span class=\"token literal-property property\">sub</span><span class=\"token operator\">:</span> input<span class=\"token punctuation\">.</span>userId<span class=\"token punctuation\">,</span>\n          <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> input<span class=\"token punctuation\">.</span>userDataInJWT<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n       \n        <span class=\"token keyword\">return</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">createNewSession</span><span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p><strong>SSO Preservation:</strong></p>\n<p>Applications using Auth0 for SSO across multiple domains require coordination:</p>\n<ol>\n<li>Deploy SuperTokens with a matching domain configuration.</li>\n<li>Maintain cookie domains consistent with the Auth0 setup.</li>\n<li>Gradually migrate applications to SuperTokens sessions.</li>\n<li>Use feature flags to control which apps use SuperTokens.</li>\n<li>Ensure session token formats remain compatible across apps.</li>\n</ol>\n<h2 id=\"planning-your-migration-rollout\" style=\"position:relative;\"><a href=\"#planning-your-migration-rollout\" aria-label=\"planning your migration rollout permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Planning Your Migration Rollout</h2>\n<p>Structured rollout planning minimizes disruption, while enabling rapid response to unexpected issues.</p>\n<h3 id=\"define-your-migration-goals\" style=\"position:relative;\"><a href=\"#define-your-migration-goals\" aria-label=\"define your migration goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Define Your Migration Goals</strong></h3>\n<p>Clear, quantifiable objectives guide strategy selection and justify engineering investment across three areas:</p>\n<ul>\n<li><strong>Cost Reduction:</strong> Calculate Auth0 spending, project SuperTokens costs, and set target savings timelines.</li>\n<li><strong>Increased Control:</strong> Identify Auth0 limitations, define compliance needs, and specify required authentication flows.</li>\n<li><strong>Feature Additions:</strong> Document new authentication methods, integrations, and security enhancements needed.</li>\n</ul>\n<h3 id=\"test-in-staging-first\" style=\"position:relative;\"><a href=\"#test-in-staging-first\" aria-label=\"test in staging first permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Test in Staging First</strong></h3>\n<p>Mirror production architecture with anonymized data and replicate the Auth0 configuration before touching production. Cover all critical test scenarios — SSO, passwordless authentication, RBAC, social login, MFA, password reset, and session management — then performance test authentication latency under load and stress test failover between both systems. Comprehensive staging validation prevents production incidents and builds confidence before cutover.</p>\n<h3 id=\"communicate-clearly-with-users\" style=\"position:relative;\"><a href=\"#communicate-clearly-with-users\" aria-label=\"communicate clearly with users permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Communicate Clearly With Users</strong></h3>\n<p>Proactive communication at every stage reduces support burden and maintains trust.</p>\n<ul>\n<li><strong>Pre-Migration:</strong> Send email announcements, add in-app banners, publish FAQs, and train your support team.</li>\n<li><strong>During Migration:</strong> Provide status updates, clear password reset instructions, and escalation paths for blocked users.</li>\n<li><strong>Post-Migration:</strong> Send confirmation emails, announce new capabilities, and collect feedback on the authentication experience.</li>\n</ul>\n<h2 id=\"addressing-migration-challenges\" style=\"position:relative;\"><a href=\"#addressing-migration-challenges\" aria-label=\"addressing migration challenges permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Addressing Migration Challenges</h2>\n<p>Common migration obstacles have established solutions that reduce risk and complexity.</p>\n<h3 id=\"dealing-with-incomplete-data\" style=\"position:relative;\"><a href=\"#dealing-with-incomplete-data\" aria-label=\"dealing with incomplete data permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Dealing With Incomplete Data</strong></h3>\n<p>Auth0 exports may lack required fields or contain inconsistent data.</p>\n<p><strong>Missing Metadata:</strong></p>\n<p>Use the Auth0 Management API to fetch complete user profiles:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"44233281211254340000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`async function enrichUserData(exportedUser) {\n  // Fetch full profile from Auth0\n  const completeUser = await auth0Management.getUser({\n    id: exportedUser.user_id,\n  });\n \n  // Get user roles\n  const roles = await auth0Management.getUserRoles({\n    id: exportedUser.user_id,\n  });\n \n  // Get user permissions\n  const permissions = await auth0Management.getUserPermissions({\n    id: exportedUser.user_id,\n  });\n \n  return {\n    ...completeUser,\n    roles: roles.map(r => r.name),\n    permissions: permissions.map(p => p.permission_name),\n  };\n}`, `44233281211254340000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">enrichUserData</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">exportedUser</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token comment\">// Fetch full profile from Auth0</span>\n  <span class=\"token keyword\">const</span> completeUser <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0Management<span class=\"token punctuation\">.</span><span class=\"token function\">getUser</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">id</span><span class=\"token operator\">:</span> exportedUser<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token comment\">// Get user roles</span>\n  <span class=\"token keyword\">const</span> roles <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0Management<span class=\"token punctuation\">.</span><span class=\"token function\">getUserRoles</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">id</span><span class=\"token operator\">:</span> exportedUser<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token comment\">// Get user permissions</span>\n  <span class=\"token keyword\">const</span> permissions <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0Management<span class=\"token punctuation\">.</span><span class=\"token function\">getUserPermissions</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">id</span><span class=\"token operator\">:</span> exportedUser<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token operator\">...</span>completeUser<span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">roles</span><span class=\"token operator\">:</span> roles<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">r</span> <span class=\"token operator\">=></span> r<span class=\"token punctuation\">.</span>name<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">permissions</span><span class=\"token operator\">:</span> permissions<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">p</span> <span class=\"token operator\">=></span> p<span class=\"token punctuation\">.</span>permission_name<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Inconsistent Data:</strong></p>\n<p>Validate and normalize during import:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"13951832637691752000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`function validateUserData(user) {\n  return {\n    email: normalizeEmail(user.email),\n    emailVerified: Boolean(user.email_verified),\n    createdAt: parseDate(user.created_at),\n    metadata: sanitizeMetadata(user.user_metadata),\n  };\n}`, `13951832637691752000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">function</span> <span class=\"token function\">validateUserData</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">user</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token literal-property property\">email</span><span class=\"token operator\">:</span> <span class=\"token function\">normalizeEmail</span><span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">emailVerified</span><span class=\"token operator\">:</span> <span class=\"token function\">Boolean</span><span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>email_verified<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">createdAt</span><span class=\"token operator\">:</span> <span class=\"token function\">parseDate</span><span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>created_at<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token literal-property property\">metadata</span><span class=\"token operator\">:</span> <span class=\"token function\">sanitizeMetadata</span><span class=\"token punctuation\">(</span>user<span class=\"token punctuation\">.</span>user_metadata<span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h3 id=\"managing-rate-limits-and-bulk-exports\" style=\"position:relative;\"><a href=\"#managing-rate-limits-and-bulk-exports\" aria-label=\"managing rate limits and bulk exports permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Managing Rate Limits and Bulk Exports</strong></h3>\n<p>Auth0 API rate limits constrain export and migration speed.</p>\n<p><strong>Rate Limit Handling:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"58896956048076960000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`async function exportWithRateLimit() {\n  const users = [];\n  let page = 0;\n  const perPage = 50; // Conservative batch size\n \n  while (true) {\n    try {\n      const batch = await auth0.getUsers({\n        per_page: perPage,\n        page: page,\n      });\n     \n      if (batch.length === 0) break;\n     \n      users.push(...batch);\n      page++;\n     \n      // Wait between requests to respect rate limits\n      await sleep(200);\n    } catch (error) {\n      if (error.statusCode === 429) {\n        // Rate limited - exponential backoff\n        const retryAfter = error.headers['retry-after'] || 5;\n        await sleep(retryAfter * 1000);\n        continue; // Retry same page\n      }\n      throw error;\n    }\n  }\n \n  return users;\n}`, `58896956048076960000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">exportWithRateLimit</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> users <span class=\"token operator\">=</span> <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">let</span> page <span class=\"token operator\">=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">const</span> perPage <span class=\"token operator\">=</span> <span class=\"token number\">50</span><span class=\"token punctuation\">;</span> <span class=\"token comment\">// Conservative batch size</span>\n \n  <span class=\"token keyword\">while</span> <span class=\"token punctuation\">(</span><span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">const</span> batch <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> auth0<span class=\"token punctuation\">.</span><span class=\"token function\">getUsers</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n        <span class=\"token literal-property property\">per_page</span><span class=\"token operator\">:</span> perPage<span class=\"token punctuation\">,</span>\n        <span class=\"token literal-property property\">page</span><span class=\"token operator\">:</span> page<span class=\"token punctuation\">,</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n     \n      <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>batch<span class=\"token punctuation\">.</span>length <span class=\"token operator\">===</span> <span class=\"token number\">0</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">break</span><span class=\"token punctuation\">;</span>\n     \n      users<span class=\"token punctuation\">.</span><span class=\"token function\">push</span><span class=\"token punctuation\">(</span><span class=\"token operator\">...</span>batch<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      page<span class=\"token operator\">++</span><span class=\"token punctuation\">;</span>\n     \n      <span class=\"token comment\">// Wait between requests to respect rate limits</span>\n      <span class=\"token keyword\">await</span> <span class=\"token function\">sleep</span><span class=\"token punctuation\">(</span><span class=\"token number\">200</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">.</span>statusCode <span class=\"token operator\">===</span> <span class=\"token number\">429</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n        <span class=\"token comment\">// Rate limited - exponential backoff</span>\n        <span class=\"token keyword\">const</span> retryAfter <span class=\"token operator\">=</span> error<span class=\"token punctuation\">.</span>headers<span class=\"token punctuation\">[</span><span class=\"token string\">'retry-after'</span><span class=\"token punctuation\">]</span> <span class=\"token operator\">||</span> <span class=\"token number\">5</span><span class=\"token punctuation\">;</span>\n        <span class=\"token keyword\">await</span> <span class=\"token function\">sleep</span><span class=\"token punctuation\">(</span>retryAfter <span class=\"token operator\">*</span> <span class=\"token number\">1000</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n        <span class=\"token keyword\">continue</span><span class=\"token punctuation\">;</span> <span class=\"token comment\">// Retry same page</span>\n      <span class=\"token punctuation\">}</span>\n      <span class=\"token keyword\">throw</span> error<span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span>\n \n  <span class=\"token keyword\">return</span> users<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Incremental Sync:</strong></p>\n<p>Use webhooks or change data capture to sync users continuously:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"6587966050741478000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`// Auth0 webhook handler\napp.post(&quot;/auth0/webhook&quot;, async (req, res) => {\n  const event = req.body;\n \n  if (event.type === &quot;slo&quot; || event.type === &quot;ss&quot;) {\n    // User login or signup - trigger migration\n    await migrateUserIfNeeded(event.user_id);\n  }\n \n  res.status(200).send();\n});`, `6587966050741478000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token comment\">// Auth0 webhook handler</span>\napp<span class=\"token punctuation\">.</span><span class=\"token function\">post</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"/auth0/webhook\"</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">req<span class=\"token punctuation\">,</span> res</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> event <span class=\"token operator\">=</span> req<span class=\"token punctuation\">.</span>body<span class=\"token punctuation\">;</span>\n \n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>event<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">\"slo\"</span> <span class=\"token operator\">||</span> event<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">\"ss\"</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// User login or signup - trigger migration</span>\n    <span class=\"token keyword\">await</span> <span class=\"token function\">migrateUserIfNeeded</span><span class=\"token punctuation\">(</span>event<span class=\"token punctuation\">.</span>user_id<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n \n  res<span class=\"token punctuation\">.</span><span class=\"token function\">status</span><span class=\"token punctuation\">(</span><span class=\"token number\">200</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">send</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"ensuring-zero-downtime-during-cutover\" style=\"position:relative;\"><a href=\"#ensuring-zero-downtime-during-cutover\" aria-label=\"ensuring zero downtime during cutover permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Ensuring Zero Downtime During Cutover</strong></h3>\n<p>Feature flags enable gradual traffic shifting without downtime.</p>\n<p><strong>Feature Flag Implementation:</strong></p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"17549331996754770000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`const featureFlags = {\n  useSuperTokensAuth: process.env.USE_SUPERTOKENS === &quot;true&quot;,\n  superTokensPercentage: parseInt(process.env.ST_TRAFFIC_PERCENT) || 0,\n};\n\n\nasync function authenticate(email, password) {\n  const useSuperTokens = featureFlags.useSuperTokensAuth ||\n    (Math.random() * 100 < featureFlags.superTokensPercentage);\n \n  if (useSuperTokens) {\n    return await authenticateWithSuperTokens(email, password);\n  } else {\n    return await authenticateWithAuth0(email, password);\n  }\n}`, `17549331996754770000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">const</span> featureFlags <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">useSuperTokensAuth</span><span class=\"token operator\">:</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">USE_SUPERTOKENS</span> <span class=\"token operator\">===</span> <span class=\"token string\">\"true\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token literal-property property\">superTokensPercentage</span><span class=\"token operator\">:</span> <span class=\"token function\">parseInt</span><span class=\"token punctuation\">(</span>process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">ST_TRAFFIC_PERCENT</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">||</span> <span class=\"token number\">0</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n\n\n<span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token function\">authenticate</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">email<span class=\"token punctuation\">,</span> password</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> useSuperTokens <span class=\"token operator\">=</span> featureFlags<span class=\"token punctuation\">.</span>useSuperTokensAuth <span class=\"token operator\">||</span>\n    <span class=\"token punctuation\">(</span>Math<span class=\"token punctuation\">.</span><span class=\"token function\">random</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">*</span> <span class=\"token number\">100</span> <span class=\"token operator\">&lt;</span> featureFlags<span class=\"token punctuation\">.</span>superTokensPercentage<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n \n  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>useSuperTokens<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token keyword\">await</span> <span class=\"token function\">authenticateWithSuperTokens</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token keyword\">await</span> <span class=\"token function\">authenticateWithAuth0</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p><strong>Gradual Rollout:</strong></p>\n<ol>\n<li>Deploy SuperTokens with 0% traffic.</li>\n<li>Increase to 5% and monitor for 24 hours.</li>\n<li>Scale to 25% if no issues are detected.</li>\n<li>Reach 50%, then 75%, then 100% incrementally.</li>\n<li>Maintain Auth0 fallback for 30 days post-cutover.</li>\n<li>Decommission Auth0 after stability confirmation.</li>\n</ol>\n<p>This approach enables rapid rollback if issues emerge while proving SuperTokens stability under real production load.</p>\n<h2 id=\"how-supertokens-simplifies-the-migration-process\" style=\"position:relative;\"><a href=\"#how-supertokens-simplifies-the-migration-process\" aria-label=\"how supertokens simplifies the migration process permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>How SuperTokens Simplifies the Migration Process</h2>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 630px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/442339e8243dc26122ede256ba2ff4cb/29007/Supertokens.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 48.734177215189874%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB40lEQVQozy2M21LTUBiFM6NN9r/P2dnHHJo00GBamtIUC1QQoSM46I13PkGficd16rgu1s23vhV9qrKrc78ZFl1b51laG9WXoS/cospb76bemSwzxmhtnPeZ1t77PM/f39+Px2N0UciZE7WTtZVnRvRWrF16V4ebJl/nuit8GXyWGcIlE4pyybhglHnvtdbRUIkuZ62lM0M7y5aWb5x86pqHeXPf+nHedudzl1eIZcANYgpRgTCdTOI4jqPrRq6mfB7YVNMmoyX5uAj6z9vrj/1ufzU8P9xvt7txdy9sHSUqEe70QgVgAgD/5dbRUkEb1ONufL65/r6//f16+Hn49nJ4fnl92z++fDn8Wmy/Yj2NmUFEAqZxnESril/kvDIkV8SndNmdjZd935R3636/We6uVpvNeDne9NuHqv8MukmES7CkXPgQojPHakuDIlbilAFFEy15aWRteet5bWUZrA8FM9MPokjSMuE2Bi7SbDXcRkERr4jmWDEQFBgBhSYulW0ZZoWf1+WsKiTBinFIQ8JdQlUClHExDOso5STlhFPECCKACEYpTjTHhRaNSxunCi0VxSmjwBQiEmGGEAACQkhECCYEA0KATsEIcQJWQmPp2BVD62pLnaKcU8DkHz8NAU79F5VdPDq/XGeYAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Supertokens\"\n        title=\"Supertokens\"\n        src=\"/static/442339e8243dc26122ede256ba2ff4cb/f058b/Supertokens.png\"\n        srcset=\"/static/442339e8243dc26122ede256ba2ff4cb/c26ae/Supertokens.png 158w,\n/static/442339e8243dc26122ede256ba2ff4cb/6bdcf/Supertokens.png 315w,\n/static/442339e8243dc26122ede256ba2ff4cb/f058b/Supertokens.png 630w,\n/static/442339e8243dc26122ede256ba2ff4cb/40601/Supertokens.png 945w,\n/static/442339e8243dc26122ede256ba2ff4cb/78612/Supertokens.png 1260w,\n/static/442339e8243dc26122ede256ba2ff4cb/29007/Supertokens.png 1600w\"\n        sizes=\"(max-width: 630px) 100vw, 630px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<p>SuperTokens provides migration-specific features, reducing implementation complexity and risk.</p>\n<h3 id=\"built-in-support-for-lazy-and-trickle-migration\" style=\"position:relative;\"><a href=\"#built-in-support-for-lazy-and-trickle-migration\" aria-label=\"built in support for lazy and trickle migration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Built-In Support for Lazy and Trickle Migration</strong></h3>\n<p>SuperTokens documentation includes migration guides with code examples for common scenarios.</p>\n<p><strong>Custom Authentication APIs:</strong></p>\n<p>Override default authentication APIs to implement fallback logic:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"46361378329884385000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied!\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`import EmailPassword from &quot;supertokens-node/recipe/emailpassword&quot;;\n\n\nEmailPassword.init({\n  override: {\n    apis: (originalImplementation) => ({\n      ...originalImplementation,\n      signInPOST: async (input) => {\n        try {\n          // Try SuperTokens first\n          return await originalImplementation.signInPOST(input);\n        } catch (error) {\n          // User not found - check Auth0\n          const email = input.formFields.find(f => f.id === &quot;email&quot;).value;\n          const password = input.formFields.find(f => f.id === &quot;password&quot;).value;\n         \n          const auth0User = await verifyAuth0Credentials(email, password);\n         \n          if (auth0User) {\n            // Import to SuperTokens\n            await importUserFromAuth0(auth0User, password);\n           \n            // Retry SuperTokens authentication\n            return await originalImplementation.signInPOST(input);\n          }\n         \n          throw error;\n        }\n      },\n    }),\n  },\n});`, `46361378329884385000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"><span class=\"token keyword\">import</span> EmailPassword <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/emailpassword\"</span><span class=\"token punctuation\">;</span>\n\n\nEmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  <span class=\"token literal-property property\">override</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function-variable function\">apis</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">originalImplementation</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      <span class=\"token operator\">...</span>originalImplementation<span class=\"token punctuation\">,</span>\n      <span class=\"token function-variable function\">signInPOST</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span><span class=\"token parameter\">input</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n        <span class=\"token keyword\">try</span> <span class=\"token punctuation\">{</span>\n          <span class=\"token comment\">// Try SuperTokens first</span>\n          <span class=\"token keyword\">return</span> <span class=\"token keyword\">await</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">signInPOST</span><span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n        <span class=\"token punctuation\">}</span> <span class=\"token keyword\">catch</span> <span class=\"token punctuation\">(</span>error<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n          <span class=\"token comment\">// User not found - check Auth0</span>\n          <span class=\"token keyword\">const</span> email <span class=\"token operator\">=</span> input<span class=\"token punctuation\">.</span>formFields<span class=\"token punctuation\">.</span><span class=\"token function\">find</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">f</span> <span class=\"token operator\">=></span> f<span class=\"token punctuation\">.</span>id <span class=\"token operator\">===</span> <span class=\"token string\">\"email\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>value<span class=\"token punctuation\">;</span>\n          <span class=\"token keyword\">const</span> password <span class=\"token operator\">=</span> input<span class=\"token punctuation\">.</span>formFields<span class=\"token punctuation\">.</span><span class=\"token function\">find</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">f</span> <span class=\"token operator\">=></span> f<span class=\"token punctuation\">.</span>id <span class=\"token operator\">===</span> <span class=\"token string\">\"password\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>value<span class=\"token punctuation\">;</span>\n         \n          <span class=\"token keyword\">const</span> auth0User <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> <span class=\"token function\">verifyAuth0Credentials</span><span class=\"token punctuation\">(</span>email<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n         \n          <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>auth0User<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n            <span class=\"token comment\">// Import to SuperTokens</span>\n            <span class=\"token keyword\">await</span> <span class=\"token function\">importUserFromAuth0</span><span class=\"token punctuation\">(</span>auth0User<span class=\"token punctuation\">,</span> password<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n           \n            <span class=\"token comment\">// Retry SuperTokens authentication</span>\n            <span class=\"token keyword\">return</span> <span class=\"token keyword\">await</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">signInPOST</span><span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n          <span class=\"token punctuation\">}</span>\n         \n          <span class=\"token keyword\">throw</span> error<span class=\"token punctuation\">;</span>\n        <span class=\"token punctuation\">}</span>\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>This pattern integrates seamlessly with SuperTokens’ existing authentication flows.</p>\n<h3 id=\"developer-centric-tooling\" style=\"position:relative;\"><a href=\"#developer-centric-tooling\" aria-label=\"developer centric tooling permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Developer-Centric Tooling</strong></h3>\n<p>SuperTokens prioritizes developer experience through comprehensive SDKs and debugging capabilities.</p>\n<p><strong>SDK Coverage:</strong></p>\n<ul>\n<li>Backend: Node.js, Python, Go</li>\n<li>Frontend: React, Vue, Angular, vanilla JavaScript</li>\n<li>Mobile: React Native, Flutter</li>\n</ul>\n<p><strong>Debugging Features:</strong></p>\n<ul>\n<li>Detailed error messages with resolution guidance</li>\n<li>Request/response logging for authentication flows</li>\n<li>Session debugging tools in the dashboard</li>\n<li>Migration event tracking and analytics</li>\n</ul>\n<p><strong>Documentation Quality:</strong></p>\n<ul>\n<li>Step-by-step migration guides</li>\n<li>Code examples for common scenarios</li>\n<li>API reference documentation</li>\n<li>Video tutorials and webinars</li>\n</ul>\n<h3 id=\"zero-lock-in-post-migration\" style=\"position:relative;\"><a href=\"#zero-lock-in-post-migration\" aria-label=\"zero lock in post migration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Zero Lock-In Post-Migration</strong></h3>\n<p>Unlike Auth0’s proprietary systems, SuperTokens maintains portability.</p>\n<p><strong>Standard Formats:</strong></p>\n<ul>\n<li>JWT tokens with standard claims</li>\n<li>OAuth 2.0 / OpenID Connect protocols</li>\n<li>Standard password hashing (bcrypt, argon2)</li>\n<li>PostgreSQL/MySQL for user storage</li>\n</ul>\n<p><strong>Export Capabilities:</strong></p>\n<ul>\n<li>Full user data export via API</li>\n<li>Direct database access for self-hosted</li>\n<li>Password hash export (self-hosted)</li>\n<li>No export fees or restrictions</li>\n</ul>\n<p><strong>Self-Hosting Option:</strong> Managed service customers can migrate to self-hosted SuperTokens without changing application code, same APIs,\nsame SDKs, different infrastructure.</p>\n<p>This architecture prevents future vendor lock-in, reducing long-term risk regardless of authentication requirements.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>Migrating from Auth0 to SuperTokens requires choosing an appropriate migration strategy: lazy, trickle, automatic, or full export; based on your user base characteristics, operational constraints, and risk tolerance. Lazy migration offers the safest gradual approach, automatic migration provides predictable timelines, full export enables controlled cutover timing.</p>\n<p><strong>Key Success Factors:</strong></p>\n<ul>\n<li>Secure user export handling with encryption and access controls.</li>\n<li>Comprehensive staging environment testing before production deployment.</li>\n<li>Clear user communication throughout the migration lifecycle.</li>\n<li>Gradual rollout with feature flags enabling rapid rollback.</li>\n<li>Monitoring and observability to detect issues early.</li>\n</ul>\n<p>SuperTokens simplifies migration through built-in support for common patterns, developer-friendly SDKs, and comprehensive documentation. The combination of managed service convenience and self-hosting flexibility prevents future lock-in, while reducing immediate Auth0 costs.</p>\n<p><strong>Next Steps:</strong></p>\n<ol>\n<li>Review the official SuperTokens migration documentation at <a href=\"https://supertokens.com/docs/migration/overview\" target=\"_blank\" rel=\"nofollow\">https://supertokens.com/docs/migration/overview</a>.</li>\n<li>Test migration strategies in the staging environment.</li>\n<li>Calculate cost savings and timeline requirements.</li>\n<li>Select a migration approach that matches your constraints.</li>\n<li>Implement a gradual rollout with monitoring.</li>\n</ol>","frontmatter":{"date":"February 27, 2026","title":"How to Migrate from Auth0 Securely and Efficiently","cover":"migrate-from-auth0.png","author":"Mostafa Ibrahim","description":"Learn how to migrate from Auth0 to SuperTokens by using lazy, automatic, or trickle migration. Includes secure export steps, pricing insights, and implementation tips."},"fields":{"slug":"/migrate-from-auth0/"}},"site":{"siteMetadata":{"title":"SuperTokens Blog"}}},"pageContext":{"id":"1a22aa92-fafa-5d78-b944-d2ed60b2461d","fields__slug":"/migrate-from-auth0/","__params":{"fields__slug":"migrate-from-auth0"}}},
    "staticQueryHashes": []}