{
    "componentChunkName": "component---src-pages-blog-markdown-remark-fields-slug-js",
    "path": "/blog/how-to-create-an-invite-only-auth-flow",
    "result": {"data":{"markdownRemark":{"html":"<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction 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>Introduction</h2>\n<p>Whether aiming to boost referrals, drive exclusivity, or simply enhance user engagement, a well-crafted invite flow can make all the difference. In this blog post, we will delve into the steps of how you can secure your React app with Email-password authentication with SuperTokens, customized to have an invite-only flow.</p>\n<h2 id=\"setup\" style=\"position:relative;\"><a href=\"#setup\" aria-label=\"setup 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>Setup</h2>\n<p>Our demo app will use a React frontend with a NodeJS backend, but the instructions should translate to other frameworks and languages. You can find the list of <a href=\"https://supertokens.com/docs/community/sdks\" target=\"_blank\" rel=\"nofollow\">SuperTokens-supported frameworks and languages here</a>.</p>\n<p>We can start a new project configured with SuperTokens using their CLI with the following command:</p>\n<p><code class=\"language-text\">npx create-supertokens-app@latest</code></p>\n<p>You should see the following output:</p>\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/3863d3c8dd1d0f1a598d1e46b355ecc6/22c86/supertokens-cli.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: 31.645569620253163%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAwElEQVQY031QUa7DIAzrKUqhBQKE0t7/gJ6cjUpPT9uHlcQKtsPiQ8C2bVjXFc45eO8fcJ48d2b9hSWLoLWGnAUpJah2jHNYTSmjlIIQwj+xb+LLvu8QKWhNEWMCDSgiIoZam6WdSZ1bv4qRN0Emo0iM0cBED3wAd47jwB7elTwN/uJtstRacd83zvPEGMPQezewJ2+zduuv64KqmjGD8CJWGlnCLBna1f6RD5iUfS3FlvjQ0n1Sznlek3J+OCZ8AVcGn5+lvYN+AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"SuperTokens CLI\"\n        title=\"SuperTokens CLI\"\n        src=\"/static/3863d3c8dd1d0f1a598d1e46b355ecc6/f058b/supertokens-cli.png\"\n        srcset=\"/static/3863d3c8dd1d0f1a598d1e46b355ecc6/c26ae/supertokens-cli.png 158w,\n/static/3863d3c8dd1d0f1a598d1e46b355ecc6/6bdcf/supertokens-cli.png 315w,\n/static/3863d3c8dd1d0f1a598d1e46b355ecc6/f058b/supertokens-cli.png 630w,\n/static/3863d3c8dd1d0f1a598d1e46b355ecc6/40601/supertokens-cli.png 945w,\n/static/3863d3c8dd1d0f1a598d1e46b355ecc6/22c86/supertokens-cli.png 1143w\"\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>Follow the prompts on-screen and set up an app with a React frontend, and NodeJs backend configured with email-password based authentication.</p>\n<p>We can now start customizing the authentication flows to enable invite-only authentication</p>\n<h2 id=\"step-1-disable-sign-ups\" style=\"position:relative;\"><a href=\"#step-1-disable-sign-ups\" aria-label=\"step 1 disable sign ups 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>Step 1: Disable Sign Ups</h2>\n<p>If you were to run the example application now, you would be greeted with the authentication page. This page allows you to sign users up. We will need to disable the sign-up UI on the frontend and disable the sign up API on the backend.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 512px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/00cb10301d2fb0bdffe36aab895cdf38/01e7c/sign-in-screen.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: 111.39240506329114%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAACXBIWXMAABYlAAAWJQFJUiTwAAAB8klEQVQ4y6VVPW/UQBC9H0lDwUdDhxACgQQtUjp+BwVCBKWAAGlAIukSRIWuuuJ0p5y9e7ZjO/s1D83a67OM1znESk+jXT8/z76dHc+ICNZaOOdG0R/MHeOE93nMguDYYNJ6vUaaCgghoLUe5fH7QaMT5DgEiPDz4hw/Ts8wn8+R5XmXaceJCQZiyExK6VEUBa6KAlVVYZMTVhKodbDghgz7XnmSMTB9WPJwbs8My7JElmU+wzELgg17bzlNUyyXy04wdvLDKogKcmTfkiTB5eXGf6CqaiiloujsiXkYthJ8C+QYJjPM89xnJ+UW/zLiglmGxWLhi5mL+KbsJjPkDTtrkG0FpEg8VF1BXTPqFtUOdbMe8dA15cCi/MU27oNIhqY5kN9HoI8PQV+fg748A31+Cjp5CTp9Dfr2qpnzOuP4Mej7AeA0bNsgdoKmFfz1BvT2FujDfdDhXdD7O6CjB6CTF6BPj5o5rx/eA727DTp+Alg1ImjdrmzC9QNQGECUFtsrBVkayLqxIzyn6W7DNjqQsx4gjgbWKH9YDGJryHYcz5sqm2Ev1MZAW+uj0gbXWkMbO12HYaHfVXheVjU2QiKRWx9XSYrVJoHI8r/4XLNdx4619tBZOkz8BvrXdtbvg8PRP6B+uxrlts9mw5b+P2DBP4nxs5VB6hGsAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"SuperTokens Sign Up screen\"\n        title=\"SuperTokens Sign Up screen\"\n        src=\"/static/00cb10301d2fb0bdffe36aab895cdf38/01e7c/sign-in-screen.png\"\n        srcset=\"/static/00cb10301d2fb0bdffe36aab895cdf38/c26ae/sign-in-screen.png 158w,\n/static/00cb10301d2fb0bdffe36aab895cdf38/6bdcf/sign-in-screen.png 315w,\n/static/00cb10301d2fb0bdffe36aab895cdf38/01e7c/sign-in-screen.png 512w\"\n        sizes=\"(max-width: 512px) 100vw, 512px\"\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<h3 id=\"disable-the-sign-up-ui-in-supertokens-frontend-config\" style=\"position:relative;\"><a href=\"#disable-the-sign-up-ui-in-supertokens-frontend-config\" aria-label=\"disable the sign up ui in supertokens frontend config 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>Disable the sign up UI in SuperTokens Frontend config</h3>\n<p>We can customize the frontend UI and use CSS to hide the sign up button.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"22134220626385904000\"\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;;\n\nSuperTokens.init({\n    appInfo: {\n        apiDomain: &quot;...&quot;,\n        appName: &quot;...&quot;,\n        websiteDomain: &quot;...&quot;\n    },\n    recipeList: [\n        EmailPassword.init({\n            signInAndUpFeature: {\n                signInForm: {\n                    style: \\`\n                        [data-supertokens~=headerSubtitle] {\n                            display: none;\n                        }\n                    \\`,\n                }\n            },\n        }),\n    ]\n});`, `22134220626385904000`)\"\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=\"tsx\"><pre class=\"language-tsx\"><code class=\"language-tsx\"><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\nSuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    appInfo<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        apiDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        appName<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        websiteDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    recipeList<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>\n            signInAndUpFeature<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n                signInForm<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n                    style<span class=\"token operator\">:</span> <span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">\n                        [data-supertokens~=headerSubtitle] {\n                            display: none;\n                        }\n                    </span><span class=\"token template-punctuation string\">`</span></span><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>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>This should hide the button which allows you to switch to the sign up screen.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 495px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/ed4bc97feb91de9090d6c5f08fc892e8/a4d88/sign-in-screen-sign-up-disabled.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: 103.16455696202532%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAABYlAAAWJQFJUiTwAAAB0UlEQVQ4y5VUTVPbMBDNP6WFnJm2HDvT39SEAzSXcs0vKIVOyCTAJMG2lMRxJFvax6xsB8Uf1GjmjdbS6mn3rbw9ACAiGGNakWXZAe/5WWvRY0I2GExcRdNo8mPwhQfC6uHyO9ntMB6P8ef2Fn/v7rCN46N93z9N0zphNTpO5d/9PR6mU6xWKyilWwlbI2S7lMHa+sG3vWOpDoQcBY8sSzGZTCCEbNWsbTRGyLOU0iFJEsRx7GbWxq+0D94rL6tpyAHskwRRFEEIgTAMHbnW2jnz7KNcK883FuUjz8SXoaYhFRrO53PMZjMEQdhYzQ9pyOB0F4uFS1kp1apdRw0Jar+DlBFEFGKzXiPVClopaF1A7d+g87lZQ2vz0Av49v9QT7nQkJQEXX8B/TwBDc9Aw1PQ4BPo6hx08wM0ugANPufrDme57/oxr0Gq64T219ec5LIPGvbdQVyfg35/B42+FRf1D7B8waZK6KUMLw1ekQqIdgYiTiF5TgBT8ctTtsdVtvw8uDDWgGzmAGtgUo1MK3c72ybTbr30cejSvtw6/46Fc2k3NYxyHFW5qRvL7RbLMMJLJLAMQjyvAjwtXxAI2drZe35Leq+9dwHz9Lr+Wl3HKw17Yd+q5/wjAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"SuperTokens Sign Up screen with sign up disabled\"\n        title=\"SuperTokens Sign Up screen with sign up disabled\"\n        src=\"/static/ed4bc97feb91de9090d6c5f08fc892e8/a4d88/sign-in-screen-sign-up-disabled.png\"\n        srcset=\"/static/ed4bc97feb91de9090d6c5f08fc892e8/c26ae/sign-in-screen-sign-up-disabled.png 158w,\n/static/ed4bc97feb91de9090d6c5f08fc892e8/6bdcf/sign-in-screen-sign-up-disabled.png 315w,\n/static/ed4bc97feb91de9090d6c5f08fc892e8/a4d88/sign-in-screen-sign-up-disabled.png 495w\"\n        sizes=\"(max-width: 495px) 100vw, 495px\"\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<h3 id=\"disable-the-sign-up-api-in-supertokens-backend-config\" style=\"position:relative;\"><a href=\"#disable-the-sign-up-api-in-supertokens-backend-config\" aria-label=\"disable the sign up api in supertokens backend config 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>Disable the sign up API in SuperTokens Backend config</h3>\n<p>We override the SuperTokens backend config to disable the public facing sign up API:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"23373273929282190000\"\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;;\n\nSuperTokens.init({\n    appInfo: {\n        apiDomain: &quot;...&quot;,\n        appName: &quot;...&quot;,\n        websiteDomain: &quot;...&quot;\n    },\n    supertokens: {\n        connectionURI: &quot;...&quot;,\n    },\n    recipeList: [\n        EmailPassword.init({\n            override: {\n                apis: (originalImplementation) => {\n                    return {\n                        ...originalImplementation,\n                        signUpPOST: undefined,\n                    }\n                }\n            }\n        })\n    ]\n});`, `23373273929282190000`)\"\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=\"ts\"><pre class=\"language-ts\"><code class=\"language-ts\"><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\nSuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    appInfo<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        apiDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        appName<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        websiteDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    supertokens<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        connectionURI<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    recipeList<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>\n            override<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>originalImplementation<span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n                    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n                        <span class=\"token operator\">...</span>originalImplementation<span class=\"token punctuation\">,</span>\n                        signUpPOST<span class=\"token operator\">:</span> <span class=\"token keyword\">undefined</span><span class=\"token punctuation\">,</span>\n                    <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>\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<h2 id=\"step-2-creating-the-invite-only-flow\" style=\"position:relative;\"><a href=\"#step-2-creating-the-invite-only-flow\" aria-label=\"step 2 creating the invite only flow 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>Step 2: Creating the invite-only flow</h2>\n<h3 id=\"create-a-protected-api-that-will-create-users-and-send-invite-links\" style=\"position:relative;\"><a href=\"#create-a-protected-api-that-will-create-users-and-send-invite-links\" aria-label=\"create a protected api that will create users and send invite links 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>Create a protected API that will create users and send invite links</h3>\n<p>To create users and send them invite links we will need to create an API on the backend which will:</p>\n<ul>\n<li>Call the <code class=\"language-text\">signUp</code> function from the SuperTokens backend SDK using the user’s email and a fake password. This fake password should be unguessable and should be shared across all invited users.</li>\n<li>Generate a password reset link and send that as an invite link to the user’s email.</li>\n<li>Once the user clicks the link, they will be shown a page asking them to input their password after which, they can login.</li>\n<li>Finally, we add an access control check to make sure that only users with the <code class=\"language-text\">admin</code> role can add additional users.</li>\n</ul>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"83665249744593040000\"\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(`\nimport express from &quot;express&quot;;\nimport { verifySession } from &quot;supertokens-node/recipe/session/framework/express&quot;;\nimport { SessionRequest } from &quot;supertokens-node/framework/express&quot;;\nimport UserRoles from &quot;supertokens-node/recipe/userroles&quot;;\nimport EmailPassword from &quot;supertokens-node/recipe/emailpassword&quot;;\n\nconst FAKE_PASSWORD = &quot;asokdA87fnf30efjoiOI**cwjkn&quot;;\n\nlet app = express();\n\napp.post(&quot;/create-user&quot;, verifySession({\n    overrideGlobalClaimValidators: async function (globalClaimValidators) {\n        return [...globalClaimValidators,\n        UserRoles.UserRoleClaim.validators.includes(&quot;admin&quot;)]\n    }\n}), async (req: SessionRequest, res) => {\n    let email = req.body.email;\n\n    let signUpResult = await EmailPassword.signUp(&quot;public&quot;, email, FAKE_PASSWORD);\n    if (signUpResult.status === &quot;EMAIL_ALREADY_EXISTS_ERROR&quot;) {\n        res.status(400).send(&quot;User already exists&quot;);\n        return;\n    }\n\n    // we successfully created the user. Now we should send them their invite link\n    await EmailPassword.sendResetPasswordEmail(&quot;public&quot;, signUpResult.user.id);\n\n    res.send(&quot;Success&quot;);\n});`, `83665249744593040000`)\"\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=\"ts\"><pre class=\"language-ts\"><code class=\"language-ts\">\n<span class=\"token keyword\">import</span> express <span class=\"token keyword\">from</span> <span class=\"token string\">\"express\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> verifySession <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/session/framework/express\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> <span class=\"token punctuation\">{</span> SessionRequest <span class=\"token punctuation\">}</span> <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/framework/express\"</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> UserRoles <span class=\"token keyword\">from</span> <span class=\"token string\">\"supertokens-node/recipe/userroles\"</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\n<span class=\"token keyword\">const</span> <span class=\"token constant\">FAKE_PASSWORD</span> <span class=\"token operator\">=</span> <span class=\"token string\">\"asokdA87fnf30efjoiOI**cwjkn\"</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">let</span> app <span class=\"token operator\">=</span> <span class=\"token function\">express</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\napp<span class=\"token punctuation\">.</span><span class=\"token function\">post</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"/create-user\"</span><span class=\"token punctuation\">,</span> <span class=\"token function\">verifySession</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    <span class=\"token function-variable function\">overrideGlobalClaimValidators</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span>globalClaimValidators<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n        <span class=\"token keyword\">return</span> <span class=\"token punctuation\">[</span><span class=\"token operator\">...</span>globalClaimValidators<span class=\"token punctuation\">,</span>\n        UserRoles<span class=\"token punctuation\">.</span>UserRoleClaim<span class=\"token punctuation\">.</span>validators<span class=\"token punctuation\">.</span><span class=\"token function\">includes</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"admin\"</span><span class=\"token punctuation\">)</span><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> <span class=\"token keyword\">async</span> <span class=\"token punctuation\">(</span>req<span class=\"token operator\">:</span> SessionRequest<span class=\"token punctuation\">,</span> res<span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">let</span> email <span class=\"token operator\">=</span> req<span class=\"token punctuation\">.</span>body<span class=\"token punctuation\">.</span>email<span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">let</span> signUpResult <span class=\"token operator\">=</span> <span class=\"token keyword\">await</span> EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">signUp</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"public\"</span><span class=\"token punctuation\">,</span> email<span class=\"token punctuation\">,</span> <span class=\"token constant\">FAKE_PASSWORD</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>signUpResult<span class=\"token punctuation\">.</span>status <span class=\"token operator\">===</span> <span class=\"token string\">\"EMAIL_ALREADY_EXISTS_ERROR\"</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n        res<span class=\"token punctuation\">.</span><span class=\"token function\">status</span><span class=\"token punctuation\">(</span><span class=\"token number\">400</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 string\">\"User already exists\"</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 punctuation\">}</span>\n\n    <span class=\"token comment\">// we successfully created the user. Now we should send them their invite link</span>\n    <span class=\"token keyword\">await</span> EmailPassword<span class=\"token punctuation\">.</span><span class=\"token function\">sendResetPasswordEmail</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"public\"</span><span class=\"token punctuation\">,</span> signUpResult<span class=\"token punctuation\">.</span>user<span class=\"token punctuation\">.</span>id<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n    res<span class=\"token punctuation\">.</span><span class=\"token function\">send</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Success\"</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<blockquote>\n<p>Note:</p>\n<ul>\n<li>The code above uses the default password reset path for the invite link (<code class=\"language-text\">/auth/reset-password</code>). You can create custom UI hosted on another path and use the password reset functions provided by the SuperTOkens frontend SDK to call the password reset token consumption API from the frontend.</li>\n<li>Additionally, the <code class=\"language-text\">sendResetPasswordEmail</code> function uses the default password reset email(or the one customized using the emailDelivery config). If you would like to create the reset password link and send it yourself, you can use the <code class=\"language-text\">createResetPasswordLink</code> function to generate the password reset string.</li>\n</ul>\n</blockquote>\n<h3 id=\"ensure-that-invited-users-have-reset-their-passwords\" style=\"position:relative;\"><a href=\"#ensure-that-invited-users-have-reset-their-passwords\" aria-label=\"ensure that invited users have reset their 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>Ensure that invited users have reset their passwords</h3>\n<p>To ensure that users who have reset their passwords, we need to make the following changes:</p>\n<ul>\n<li>Prevent users from signing in with the <code class=\"language-text\">FAKE_PASSWORD</code>.</li>\n<li>Prevent users from resetting their password by setting their new password as the <code class=\"language-text\">FAKE_PASSWORD</code>.</li>\n<li>Prevent users from updating their password and setting it to the <code class=\"language-text\">FAKE_PASSWORD</code>.</li>\n</ul>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"41654283150598410000\"\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;;\n\nconst FAKE_PASSWORD = &quot;asokdA87fnf30efjoiOI**cwjkn&quot;\n\nSuperTokens.init({\n    appInfo: {\n        apiDomain: &quot;...&quot;,\n        appName: &quot;...&quot;,\n        websiteDomain: &quot;...&quot;\n    },\n    supertokens: {\n        connectionURI: &quot;...&quot;,\n    },\n    recipeList: [\n        EmailPassword.init({\n            override: {\n                apis: (originalImplementation) => {\n                    // ... override from previous code snippets...\n                    return originalImplementation\n                },\n                functions: (originalImplementation) => {\n                    return {\n                        ...originalImplementation,\n                        updateEmailOrPassword: async function (input) {\n                            // This can be called on the backend\n                            // in your own APIs\n                            if (input.password === FAKE_PASSWORD) {\n                                throw new Error(&quot;Use a different password&quot;)\n                            }\n\n                            return originalImplementation.updateEmailOrPassword(input);\n                        },\n                        resetPasswordUsingToken: async function (input) {\n                            // This is called during the password reset flow\n                            // when the user enters their new password\n                            if (input.newPassword === FAKE_PASSWORD) {\n                                return {\n                                    status: &quot;RESET_PASSWORD_INVALID_TOKEN_ERROR&quot;\n                                }\n                            }\n                            return originalImplementation.resetPasswordUsingToken(input);\n                        },\n                        signIn: async function (input) {\n                            // This is called in the email password sign in API\n                            if (input.password === FAKE_PASSWORD) {\n                                return {\n                                    status: &quot;WRONG_CREDENTIALS_ERROR&quot;\n                                }\n                            }\n                            return originalImplementation.signIn(input);\n                        },\n                    }\n                }\n            }\n        })\n    ]\n});`, `41654283150598410000`)\"\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=\"ts\"><pre class=\"language-ts\"><code class=\"language-ts\"><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\n<span class=\"token keyword\">const</span> <span class=\"token constant\">FAKE_PASSWORD</span> <span class=\"token operator\">=</span> <span class=\"token string\">\"asokdA87fnf30efjoiOI**cwjkn\"</span>\n\nSuperTokens<span class=\"token punctuation\">.</span><span class=\"token function\">init</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n    appInfo<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        apiDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        appName<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n        websiteDomain<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    supertokens<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n        connectionURI<span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    recipeList<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>\n            override<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>originalImplementation<span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n                    <span class=\"token comment\">// ... override from previous code snippets...</span>\n                    <span class=\"token keyword\">return</span> originalImplementation\n                <span class=\"token punctuation\">}</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>originalImplementation<span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n                    <span class=\"token keyword\">return</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\">updateEmailOrPassword</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                            <span class=\"token comment\">// This can be called on the backend</span>\n                            <span class=\"token comment\">// in your own APIs</span>\n                            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">.</span>password <span class=\"token operator\">===</span> <span class=\"token constant\">FAKE_PASSWORD</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                                <span class=\"token keyword\">throw</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">Error</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Use a different password\"</span><span class=\"token punctuation\">)</span>\n                            <span class=\"token punctuation\">}</span>\n\n                            <span class=\"token keyword\">return</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">updateEmailOrPassword</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 function-variable function\">resetPasswordUsingToken</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                            <span class=\"token comment\">// This is called during the password reset flow</span>\n                            <span class=\"token comment\">// when the user enters their new password</span>\n                            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">.</span>newPassword <span class=\"token operator\">===</span> <span class=\"token constant\">FAKE_PASSWORD</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                                <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n                                    status<span class=\"token operator\">:</span> <span class=\"token string\">\"RESET_PASSWORD_INVALID_TOKEN_ERROR\"</span>\n                                <span class=\"token punctuation\">}</span>\n                            <span class=\"token punctuation\">}</span>\n                            <span class=\"token keyword\">return</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">resetPasswordUsingToken</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 function-variable function\">signIn</span><span class=\"token operator\">:</span> <span class=\"token keyword\">async</span> <span class=\"token keyword\">function</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                            <span class=\"token comment\">// This is called in the email password sign in API</span>\n                            <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>input<span class=\"token punctuation\">.</span>password <span class=\"token operator\">===</span> <span class=\"token constant\">FAKE_PASSWORD</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n                                <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n                                    status<span class=\"token operator\">:</span> <span class=\"token string\">\"WRONG_CREDENTIALS_ERROR\"</span>\n                                <span class=\"token punctuation\">}</span>\n                            <span class=\"token punctuation\">}</span>\n                            <span class=\"token keyword\">return</span> originalImplementation<span class=\"token punctuation\">.</span><span class=\"token function\">signIn</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>\n                <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>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>And that’s it! Your app now only allows invited users to log in. Once a user is invited they will be sent an email asking to reset their password post which they are able to sign in.</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>Although there are a few customizations that needed to be made, setting up an invite only flow with SuperTokens is pretty straight forward. You can find the related <a href=\"https://supertokens.com/docs/emailpassword/common-customizations/disable-sign-up/emailpassword-changes\" target=\"_blank\" rel=\"nofollow\">documentation for the invite flow here</a> if you need the code for other languages/frameworks.</p>","frontmatter":{"date":"September 28, 2023","title":"How to create an invite-only auth flow in 2023","cover":"how-to-create-an-invite-only-auth-flow.png","author":"Joel Coutinho","description":"Invite only flows can drive exclusivity and enhance user engagement. In this blog we will go over how you can customize SuperTokens authentication to create an invite only flow"},"fields":{"slug":"/how-to-create-an-invite-only-auth-flow/"}},"site":{"siteMetadata":{"title":"SuperTokens Blog"}}},"pageContext":{"id":"973d1df5-5c40-50eb-934d-4b2c0f2c3116","fields__slug":"/how-to-create-an-invite-only-auth-flow/","__params":{"fields__slug":"how-to-create-an-invite-only-auth-flow"}}},
    "staticQueryHashes": []}