{"componentChunkName":"component---src-templates-tag-js","path":"/tags/cli/","result":{"data":{"site":{"siteMetadata":{"title":"LoginRadius Blog"}},"allMarkdownRemark":{"totalCount":5,"edges":[{"node":{"fields":{"slug":"/engineering/introducing-loginradius-cli/"},"html":"<p>Hi Everyone 👋 !!! Today we are announcing the beta release of <a href=\"https://github.com/LoginRadius/lr-cli#readme\">LoginRadius CLI</a>. I am very much excited about it.</p>\n<h2 id=\"why-loginradius-cli\" style=\"position:relative;\"><a href=\"#why-loginradius-cli\" aria-label=\"why loginradius cli 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>Why LoginRadius CLI?</h2>\n<p>Developer Experience plays a crucial role for us. We always think about the ways we can minimize the juggling between a quickstart tutorial, dashboard, and terminal.\nThe LoginRadius CLI will simplify your flow by just using some simple commands to <strong>register, login, add site, add social, etc.</strong>, and enables you to get the job done in very little time without leaving the terminal. </p>\n<h2 id=\"how-can-you-use-loginradius-cli\" style=\"position:relative;\"><a href=\"#how-can-you-use-loginradius-cli\" aria-label=\"how can you use loginradius cli 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 can you use LoginRadius CLI</h2>\n<p>Check out a few examples of how LoginRadius CLI can help manage your <a href=\"https://dashboard.loginradius.com/\">Loginradius Dashboard</a>.</p>\n<h3 id=\"loginregister-to-your-loginradius-dashboard\" style=\"position:relative;\"><a href=\"#loginregister-to-your-loginradius-dashboard\" aria-label=\"loginregister to your loginradius dashboard 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>Login/Register to your LoginRadius Dashboard</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 39.23076923076923%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsTAAALEwEAmpwYAAABoklEQVQoz5WS23PSQBSHM+OU224AxSC0EEhCuBUSbinQCi3QC9GOo6Pj5cGxHR8d/f/fPnehdXzxwYdvfntyzp6c3+4a1vkdjVlMfnmLDGJkf4v4b2JE7wYx/YRRdyJW3hFWYJNMlxCZQ6Q4Qii0SvkX4h/onN5rtTGEOyeV97Fe9PFaU3LPfdLZOvKpS8qskRBVkrK6Ux2LvKtwdqpr9DqTU5g2ohxgFNsLOt0Z3XDBYLzC9SPcZkS7d0ZvsGR6umV8ckkwumAwWeP4E2xnSLnap1IL1RAn2O6IguUjy32MbD1SDacch0uandme7ny36Tr+yP33X3y9+8G3+59sX39m/vIV8e0Xlqs3u3h1+Y5DO6DuDslVQoxC84zu8Zz+8GLXSE/hqr8Oow3dYMGzYotswdvbzNXVtFesr99zvnnL5uYDoXKVEBXS6lhEqacsN09pNoY0lE2/FeF4I1zFRDX0/DHFUouMrGDmasiszUGyxJOD4h8SqfI+p2pEsaMuRT0V0x5jKutSqaiOMGsT9FHo9eO3R3Ss8+aD7vMPNZ01vwHc4ORnyw0XpgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Login Command\"\n        src=\"/static/20378843f2b588ccb2e890368d4ad825/e5715/login.png\"\n        srcset=\"/static/20378843f2b588ccb2e890368d4ad825/a6d36/login.png 650w,\n/static/20378843f2b588ccb2e890368d4ad825/e5715/login.png 768w,\n/static/20378843f2b588ccb2e890368d4ad825/7a3d6/login.png 990w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>This command will help you to log in to the CLI. Once you logged in to the CLI, you can configure all your LoginRadius Applications through CLI. </p>\n<h3 id=\"manage-your-app-credentials\" style=\"position:relative;\"><a href=\"#manage-your-app-credentials\" aria-label=\"manage your app credentials 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>Manage your App Credentials</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 78.15384615384615%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAACtklEQVQ4y41U2W7TUBC1hFC9Nk6c2PESx7ETx9kdN0uTNjRdVCGxCwEVQoD6wqfwzBcfZm4btUJtxcPRta9nztwzZ64ld30F7/wrjLMraMsv0A9voC0//ycodkW5i0/Qrv9A2louLgof5sSH+rwGdc8m1KDJNnTFeRzyPSh16M9MaOe/IGn7TehWCrPaRdnJYNpdWPUejEobMn2T9yMoBLXUEs8M1WxBryTQyregWN1oQLsgQtcfoZUuMZqeIIynGIw36I+PETQnqAdD+LQ6/gAVO0XYmoqYci2FYoTQiVgrRdDMGLpGCrfXkIJmgaS/QX5wik7vEEm6QDY8Qn90jHx2huX6JdabVxgXW0yKUxTzC/ToGxdjMkHKhDoRnvyEVDIjmLUuam4PjjcQAZbD7306SUecjpMZFTpZldrBexz/IKFNAQFJCaIJSd2gGRfoDtaI07kIZmm7RIZKfVWMplh3e3r5HqHjDuC3ZmhnS7S7C9heH4PJBo0oJ/lzsZ/2V2h1ZvDCsSDjAlxI1hti3dOpqOZB20kuVTskJRMJLNsit1mSWW0TOnAbI9EGj1Y3GIl9juWiLL/ZnsEkHuXFD0g1GhOWOp5uqdlH4jRsAL9nJJ1d5Qlg0+aHl8K4kpUIx9nAgEhTirOsGMrmO6QqGRJn65txIfe4f+wmk03n5xjlJ2KM+BsbddfHRyR7jQkanbUYnVZ3hSCeIUrJlN4xvObNKQoi5l7+a9CDpvBgJ8NT+PGChjcjOW06QSTABnAC7xmcdEtwNy473CP0Qpr+Lg1qmCOfXyLJVnCp4QzbH1L1RFw1TtLKj4CuIV89cVMqugeHZtEmc+o0QiZVj8KhQOBlMKg3uvoUXLp2tD6vQGWXVfrtKLMPkIu3kKdvoNC6l7++Bb0fvIP6JN5DXXyESr8y9dtv/AUIlLwDXYfWsAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"API Credentials Commands\"\n        src=\"/static/6cbea556fc7286af4d9883543de16466/e5715/api-cred.png\"\n        srcset=\"/static/6cbea556fc7286af4d9883543de16466/a6d36/api-cred.png 650w,\n/static/6cbea556fc7286af4d9883543de16466/e5715/api-cred.png 768w,\n/static/6cbea556fc7286af4d9883543de16466/9c177/api-cred.png 880w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Get your API Credentials in a single command. You can also reset your secret and generate sott using the LoginRadius CLI.</p>\n<h3 id=\"domain-whitelisting\" style=\"position:relative;\"><a href=\"#domain-whitelisting\" aria-label=\"domain whitelisting 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>Domain Whitelisting</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 605px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 70.74380165289257%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAACgUlEQVQ4y5VT227aQBBFlZrEu8YYYnOxDYSLMWBMgACxgRIoKYQqUtQ+NBD1mrc+9Rva5/7z6eyGRK2SqurD0eyOd87OmeON8Xffwd0pmL8Cb56DN3Zo/gf8JVRvBr7+htizyUe8NYv4GtWxuXAQv6oicWhBPchB5RRZ7t8Q556nwIMLxJSzW2TjNqyci5xdBncq4MkSWKIERTuCkjiSa54sQyXwp5CqQlUd8M4lYnzyQW5Uow6uV6EnXeiGh8OMh6zTgpltyLWqEymR/x7vwXW6jNvU4Rqxg3BD3XnIV4fIOG0U3AhOJUSjNUY4XqN/+grNYCILtVT5EdkfhK0VSQ5vkE5nUGsN0RucS6JCqQvPHyHonqHdm6Fz8hKDcIk85Q/ihacJVUG4FIRbZDJZVJt9tLtzuI0QTvFYEreOpyiUe7LDWiNCjkbAtOLfCcnt2P5wi3zBgtceUCcLKbFO3U3nV7SfE1EItx7idHwhZ8m0x5KFWQ+EjDrUE1mkMi6co45EKl0jeR1pSNpqSqI85XmiCIUk30N0K9fiEuGyJIw20CiZMOvy99ANF1Y+QNKsSZcN4XLao6IidNODmWvIfNb25RlxoWn54HzXoRJe0ww9WKUB0nYg53ZCsr1mJF3uDRZStmG1YJf6GEZLkr+muJJngs4ZfKphzLozZe/0Gm61i+niDcLJa3J3LI0YTS9hk8xi5QQuFfbJ5Yo3pLhCvTWBR6YF3Rm6w3P4nRniGo1A/DYs2kLbN6DG84jHHdm6HLB4TmItpAiIDiiyXRTfZW63V/cM+a5j7NNPsNkt4QuUyXuw8Q3YaCuhjDYPYA/x7hsbb+/OvqCa2WewOXFsfuAXI/yJS93EZyAAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Domain Commands\"\n        src=\"/static/f5950fca820daea07c795ea15241b7e4/90cbd/domain.png\"\n        srcset=\"/static/f5950fca820daea07c795ea15241b7e4/90cbd/domain.png 605w\"\n        sizes=\"(max-width: 605px) 100vw, 605px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Manage your white-listed domain for your application with simple commands.</p>\n<h3 id=\"theme-management\" style=\"position:relative;\"><a href=\"#theme-management\" aria-label=\"theme management 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>Theme Management</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 60.46153846153845%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAAByUlEQVQoz5WTW2+bQBCFeaqEF4ONuRtfMdflEhtUOWlIUBIllfKUqO/9D/3/0umwpmqjNm778GmG1eyZMztC0p+/IeheMb3/gtHhBawZqP+D5vUU26+QrLjD3ndgbH2MZBdMdig6UJgHZeT+I1Qr22CzENI4f8LETGF6F1gEDbKypTyH7uZQplsw4kd8nwDKZAPmFpCM6gFRdMBl+4woPWITNlhs9mBUoAww7Wf+J0StugKzOaRJ3sLzI1T1PbxliQ/MhzxeksgaIyo6J/QGrRfMaOT0FpYdYr4qsNxUMOxEiGmzHaZmKETPIY+HvDfRC2r8AZaTkVhC5MgKcryqsA5qJPknWF4mmNmxiIaTwPa4aGy6KRw/p3MOk87HTg5pVj6C8yPKwx2i7AqclpJXN/TdYb2rhUB/Wbci2HM+NODU4FdBakQN1dNSntA0dyj2nRAq9rdCjFctwuQo3nVOjlU9EG/7+8jLtyPrxSPK8prGu0bMr8jlpehqOql4w4kRCgd9PL+U9WnLwmHdoSSHVe+SRi4ubkS+iz9itT0IB6zfOF16F5UcWikkVnyGQuMoVgLNTqEOcWzGmLr0+H4BxYjA/gb9JWxR4zuefEPA4ACcsQAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Theme Management Commands\"\n        src=\"/static/d2c52b4d79f1632b8cdf80e29412774b/e5715/theme.png\"\n        srcset=\"/static/d2c52b4d79f1632b8cdf80e29412774b/a6d36/theme.png 650w,\n/static/d2c52b4d79f1632b8cdf80e29412774b/e5715/theme.png 768w,\n/static/d2c52b4d79f1632b8cdf80e29412774b/d56e1/theme.png 1130w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>You can update the LoginRadius IDX Page theme from the predefined themes available through LoginRadius CLI. </p>\n<blockquote>\n<p>You can check out the <a href=\"\">Theme Customization</a> section in the LoginRadius Dashboard for all the available customization options.</p>\n</blockquote>\n<h3 id=\"add-social-logins\" style=\"position:relative;\"><a href=\"#add-social-logins\" aria-label=\"add social logins 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>Add Social Logins</h3>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 59.53846153846154%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAAAsTAAALEwEAmpwYAAABz0lEQVQoz41SW1LbQBDUp6WVJRtZT8t6I+stG+PCMmCcVCDJATgB9z9DZ3YDFLgg5KOrZ1banumZlaIfT8iPD1C2P8HKe7D6AWpDqD8G+xfa35CsdIBjuNCMANp4AcbmGI1syLILeeRAIVYUT+SK4kKl75/Dg6QXR4TxBmV3QNUfkNd7LJILeEEPP17DDTqYbiVix2/BJjHUaSLAJiegM8msv6HrbrDkQnQpJLGsuEJyvkWUXcLyKozpx6l5Dt3IwPQIKhf9BEKwaa+RVwPmYQ/XbxCQsIgXLfxoJQQVLfxSTAhOlwd48xo2CflRT7YaITJzShFz8M7kcShEFRIV/AF4QUnPb+GQLTdcI0gvRVeTWUZzKzGzCxj28pVNKjI1c/FN5MQcZ1YuRqOdpZCM8g51M6Ak22G2RUGzDNMLMcu82qFo9jTLDXVciEtckHfNc5uc8TMuzhvhTiSr+Y6WltKuadvpGlm5oUrvh8/e2qT41f4byOPgr2Wnu0e/OmA7/KJNX8OaV4hpwx49F/5E2MvAn5+KOjnhkzPJru6wave0mApBlEHTA6hUTdND4sX/Q/UFJHb1CDXdgxHUbEc8QEkI8U4wS57zL8Dvs+URfwAbbkIPvNEj9QAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Social Commands\"\n        src=\"/static/4213e34da4f8ce6990c9dd5c6d550b21/e5715/social.png\"\n        srcset=\"/static/4213e34da4f8ce6990c9dd5c6d550b21/a6d36/social.png 650w,\n/static/4213e34da4f8ce6990c9dd5c6d550b21/e5715/social.png 768w,\n/static/4213e34da4f8ce6990c9dd5c6d550b21/6c2de/social.png 1334w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>With the help of LoginRadius CLI, you can add social logins to your LoginRadius IDX Page.</p>\n<h3 id=\"learn-more-about-the-loginradius--cli\" style=\"position:relative;\"><a href=\"#learn-more-about-the-loginradius--cli\" aria-label=\"learn more about the loginradius  cli 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>Learn More about the LoginRadius  CLI</h3>\n<p>Run <code>lr --help</code> to get the list of all available commands. Also you can checkout the <a href=\"https://www.loginradius.com/open-source/cli/manual\">manual for all the commands supported</a>.</p>\n<h2 id=\"try-loginradius-cli\" style=\"position:relative;\"><a href=\"#try-loginradius-cli\" aria-label=\"try loginradius cli 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>Try LoginRadius CLI</h2>\n<p>The LoginRadius CLI is available for Windows, macOS, and Linux. <a href=\"https://github.com/LoginRadius/lr-cli/tree/main#readme\">Check out the installation on our README</a>.</p>\n<h2 id=\"help-us-to-improve\" style=\"position:relative;\"><a href=\"#help-us-to-improve\" aria-label=\"help us to improve 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>Help us to improve</h2>\n<p>We hope you’ll love the LoginRadius CLI. And we’re even more excited about the future as we explore what it looks like to build a truly delightful experience with LoginRadius on the command line. </p>\n<p>We can’t wait to hear about your experience with LoginRadius CLI, and we’d love your feedback. Please create an issue in our <a href=\"https://github.com/LoginRadius/lr-cli/issues\">open source repository</a> or discuss what more commands you feel should be there on our <a href=\"https://community.loginradius.com/\">community page</a>.</p>\n<p><a href=\"https://www.loginradius.com/open-source/cli\">Checkout for more details</a></p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"July 02, 2021","updated_date":null,"title":"Introducing LoginRadius CLI","tags":["Authentication","DevTools","CLI","LoginRadius CLI"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/65b9c38d8aa61635972b0d2271c28c36/bc59e/cli.png","srcSet":"/static/65b9c38d8aa61635972b0d2271c28c36/69585/cli.png 200w,\n/static/65b9c38d8aa61635972b0d2271c28c36/497c6/cli.png 400w,\n/static/65b9c38d8aa61635972b0d2271c28c36/bc59e/cli.png 512w","sizes":"(max-width: 512px) 100vw, 512px"}}},"author":{"id":"Mohammed Modi","github":"mohammed786","avatar":null}}}},{"node":{"fields":{"slug":"/engineering/implement-authentication-in-react-using-loginradius-cli/"},"html":"<p>Hey Everyone !!! This blog will walk you through the steps necessary to quickly implement authentication mechanisms for your React application by leveraging <a href=\"https://accounts.loginradius.com/auth.aspx?return_url=https://dashboard.loginradius.com/login\">LoginRadius</a> and the <a href=\"https://github.com/LoginRadius/lr-cli\">LoginRadius CLI</a> with the help of examples. </p>\n<p>Using the LoginRadius CLI, you can perform basic actions of your LoginRadius Dashboard through the command line. The actions include login, register, logout, social configuration, domain whitelisting, site management, etc. Once the actions are performed, changes will be reflected in your application. </p>\n<h2 id=\"configuring-loginradius\" style=\"position:relative;\"><a href=\"#configuring-loginradius\" aria-label=\"configuring loginradius 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>Configuring LoginRadius</h2>\n<p>Please follow the steps below to install the LoginRadius CLI on your system. Once completed, use the CLI to finish registration on the LoginRadius portal and create your application. </p>\n<h3 id=\"loginradius-cli-setup\" style=\"position:relative;\"><a href=\"#loginradius-cli-setup\" aria-label=\"loginradius cli 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>LoginRadius CLI Setup</h3>\n<h4 id=\"mac-or-linux\" style=\"position:relative;\"><a href=\"#mac-or-linux\" aria-label=\"mac or linux 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>Mac or Linux</h4>\n<ul>\n<li>\n<p>Install the tap using:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ brew tap loginradius/tap</span></span></code></pre>\n</li>\n<li>\n<p>Then, you can install LR CLI via:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ brew install lr</span></span></code></pre>\n</li>\n</ul>\n<h4 id=\"other-platforms\" style=\"position:relative;\"><a href=\"#other-platforms\" aria-label=\"other platforms 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>Other Platforms</h4>\n<ul>\n<li>Packaged binaries are available on the <a href=\"https://github.com/loginradius/lr-cli/releases/latest\">release page</a>.</li>\n</ul>\n<p>Once you have the CLI installed, the following command can be used to complete the registration process via the LoginRadius portal. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ lr register</span></span></code></pre>\n<p>This command will open the Portal in the browser, where you can register yourself and create the app.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAABPUlEQVQoz62SzUrDQBSFZ5E0av3BheDCQsHWpMWNtCCaNCm4EARBcCGu3IqP6YskgUBFJFqsJm0mOc5ME5xQIxa8cLhnJszHuZeQzY6FDcPEVncA4fW5V5p9WFd3cD0PHpPresLLKu5938do9IQgCEDUtgm1bUFp8T73mj4A2ethePuAZYtoBwxQkolVgwEbPTg390jTVIhSiizL2JNM9OJeFmUSQLV1CmX/BDWWkJ8FkCdkQLlmSYKPKEIUT3M4FjqpMdj64Rm2j86hGUMBrQJ+RjFewlc8h28szTeo8I/eGIQn2+lfoGlfY/f4EvWugxW+w0a/BCwS8NEmk3ckCRVejJ9/c8P47yPzhyINTRFPZ2KnBbA8cg6RVQWsKhkqEnKorN8S/qSFhHxn9Y6DNSZNtxnQXiph6T/8b+AXX52JrLgCSCEAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Register Page\"\n        src=\"/static/6b5302923e16cbb46586e327f58d68ed/e5715/register_page.png\"\n        srcset=\"/static/6b5302923e16cbb46586e327f58d68ed/a6d36/register_page.png 650w,\n/static/6b5302923e16cbb46586e327f58d68ed/e5715/register_page.png 768w,\n/static/6b5302923e16cbb46586e327f58d68ed/29114/register_page.png 1920w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>If you already have a LoginRadius account, use the command below to directly login :</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ lr login</span></span></code></pre>\n<p>Once you successfully register or login, the below message will be visible in a new tab on the browser. Close the tab and return to the CLI. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">You are Successfully Authenticated, Kindly Close this browser window and go back to CLI.</span></code></pre>\n<p>If your account has multiple sites (for Developer/Developer Pro Plans), an option will be given to choose the site that you wish to login with. You can choose a site according to your preference.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ lr login</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  Successfully Authenticated, Fetching Your Site(s)...</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">? Current Site is: &lt;value&gt;, Want to Switch? Yes</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">? Select the site from the list: &lt;value&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  Site has been updated.</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  Successfully Logged In</span></span></code></pre>\n<h3 id=\"fetching-application-api-credentials\" style=\"position:relative;\"><a href=\"#fetching-application-api-credentials\" aria-label=\"fetching application api credentials 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>Fetching Application API Credentials</h3>\n<p>Once the <strong>login/register</strong> process has been completed, run the <code>lr get config</code> command to fetch your <strong>API Key/Secret</strong> as shown below. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 37.53846153846154%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA5UlEQVQoz6XQX2vCMBAA8EuatDRdm/6xFpk+us+253XfY+973/w8gogPYsdqeiqbn2EXaMGB8cXAj7uQy3EJSClfLACorxFC1Eqp1zAMa8557agb7j9DEAQn0tJmf43v+ybLMtRao+d5xlVH7NkGgLOGki0w1nBf2NzaOTQOw/kSglh1xfyxK56mx2JSHkaz6qBGGlWpMUkTFDQVY8z0E7gMU66BS2GicWqiKsMwUp2O4+5hkqNtGlc5JrlGyfitp+7/NaT1Tb76eEvrcFmzsg3P5ER+7/DTR/uf8E4+yOIOn32Ptz96oYVO+oCFOgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"API Credentials\"\n        src=\"/static/155924af3d07efd63686c2832452531d/e5715/api_creds.png\"\n        srcset=\"/static/155924af3d07efd63686c2832452531d/a6d36/api_creds.png 650w,\n/static/155924af3d07efd63686c2832452531d/e5715/api_creds.png 768w,\n/static/155924af3d07efd63686c2832452531d/67a79/api_creds.png 1408w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<h3 id=\"configuring-callback-urls\" style=\"position:relative;\"><a href=\"#configuring-callback-urls\" aria-label=\"configuring callback urls 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>Configuring Callback URLs</h3>\n<p>Here, a callback URL refers to a URL in your application that LoginRadius would redirect a user to after they have been authenticated.  These URLs must be added to your Application Configuration. If not set, users will be unable to login into the application and receive an error. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 49.69230769230769%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsTAAALEwEAmpwYAAABHklEQVQoz42R3XKCMBCFef/nskIr4h1iwER+IiYtDjAaxAjtSRidtjf6kc0cJpzdJetcr9emNZxOJ+yNpe/72zO01g6+E0JU1Vdd11V1LArOC9513fczjBlxECJNM5DnxdGCjK+a8zwnhMRYcSzlJ1CqG8dxam8Yhn/igYPAn8KPwqklSbaMsfV6jWw7xqIoQl+MUmiAApRSXBByOQgpRBAEvu8vPvzlIgiWq7fZfD5zVxbP9ZIkOVjKssQupVRKmcrGLIXnvbuuRzYxi8ok5NuQ03C/o9mGEEoZzGEYoiAxxFma4UaNWd9027Sc79EbhoSUZzzqPKHu6iEAer5cJrPWfY9hI4m+vAbKwmAvTGs7cAPENP/7uv0Vv4/M6w/SdjM1cIAxmgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"alt_text\"\n        src=\"/static/d2ce3fdc3f3a78d6bc963b6d58068857/e5715/whitelist_error.png\"\n        srcset=\"/static/d2ce3fdc3f3a78d6bc963b6d58068857/a6d36/whitelist_error.png 650w,\n/static/d2ce3fdc3f3a78d6bc963b6d58068857/e5715/whitelist_error.png 768w,\n/static/d2ce3fdc3f3a78d6bc963b6d58068857/00172/whitelist_error.png 1044w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<p>For security reasons, LoginRadius only processes API calls that are received from the whitelisted domains. To get the list of whitelisted domains, run <code>lr get domain</code> command from the CLI. Similarly, to add a domain, use the <code>lr add domain</code> command.</p>\n<blockquote>\n<p>For the purposes of this tutorial, make sure that you set <code>http://localhost</code> as a whitelisted domain. </p>\n</blockquote>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 52.15384615384615%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABD0lEQVQoz53Sz0rDMBzA8fxv1zVZ2o7uIIJnX2VP5WEedhTUhxO3detviVoGvoG/aIRVimgPHwJJ+01ISxhjaymlp4Q+EUKef8L1jbV2p7XeUko3Q8+g8K5Da0TuuBKeJ3Kr9GTPJG9wboeafwgb+dAKwYesKE719ZWrLy98WdU+nxrHGAdcaxH8wR51ofUZ5EJ2iclaNUlBCAkyUUAFA8oRpcBoGNn3BkP6wbTIT3pRglnMXT4zzlSFm5bWmXnptLbOziqvVHo8O/HvQbzDTmXpQTABSiZHwQUEUqivE+N4FoKBcD+I3uJkO1IveI9e49c6jNTERmiRR/Qe/6OXkVxshBZZohu0QrcjrWJj+QF3nKm34QUQlAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Add Domain\"\n        src=\"/static/de3e6522371988cb07ec97614246ac15/e5715/domain.png\"\n        srcset=\"/static/de3e6522371988cb07ec97614246ac15/a6d36/domain.png 650w,\n/static/de3e6522371988cb07ec97614246ac15/e5715/domain.png 768w,\n/static/de3e6522371988cb07ec97614246ac15/891d5/domain.png 1520w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<h2 id=\"setup-react-js-application\" style=\"position:relative;\"><a href=\"#setup-react-js-application\" aria-label=\"setup react js application 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 React JS application</h2>\n<p>This tutorial uses a <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/React/react_auth_demo\">demo app</a> based on the Create React App (CRA) boilerplate. For instructions on how to create a React App, refer to the following <a href=\"https://reactjs.org/docs/create-a-new-react-app.html\">docs</a>.</p>\n<p>The React Demo Application mentioned here will display the User Profile data if the login process is completed successfully.</p>\n<p>After setting up the boilerplate:</p>\n<ul>\n<li>\n<p>From the project root, install <code>react-router-dom</code>.</p>\n<p><code>npm install react-router-dom</code></p>\n</li>\n<li>Create <code>src/config.js</code> and add the application details in the code as shown below.</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">APP_NAME:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;&lt;&lt;App Name&gt;&gt;&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">API_KEY:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;&lt;&lt;API Key&gt;&gt;&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  };</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\">;</span></span></code></pre>\n<blockquote>\n<p>This tutorial uses LoginRadius Auth Page(IDX) for authentication, where Registration and Login functionality is already implemented. For example, you can navigate your Register buttons to <code>https://&#x3C;LoginRadius APP Name>.hub.loginradius.com/auth.aspx?action=register&#x26;return_url=&#x3C;Return URL></code>. </p>\n</blockquote>\n<h2 id=\"add-code-to-your-application\" style=\"position:relative;\"><a href=\"#add-code-to-your-application\" aria-label=\"add code to your application 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>Add Code to your Application</h2>\n<ul>\n<li>For this demo, we will start by populating the <code>App.js</code> file as shown below. Notice that the <code>/login</code> route has been added to the App component in which the <code>Login</code> and <code>Logout</code> components are rendered. They will be used to get the user profile data and handle user logout, respectively. The <code>/</code> route will load the <code>LandingPage</code> component. If you already have an existing React application, you can specify the route for these components as per your requirements. </li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">BrowserRouter</span><span class=\"mtk1\"> </span><span class=\"mtk15\">as</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Router</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Route</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Switch</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react-router-dom&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;./App.css&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">LandingPage</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;./components/LandingPage&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Login</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;./components/Login&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Logout</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;./components/Logout&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">App</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Router</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">className</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;App&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Switch</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Route</span><span class=\"mtk1\"> </span><span class=\"mtk12\">exact</span><span class=\"mtk1\"> </span><span class=\"mtk12\">path</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;/&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">LandingPage</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Route</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Route</span><span class=\"mtk1\"> </span><span class=\"mtk12\">path</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;/login&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">style</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">{ </span><span class=\"mtk12\">display:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;flex&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">padding:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;1em&quot;</span><span class=\"mtk1\"> }</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">              </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Login</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">              </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Logout</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Route</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Switch</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Router</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk12\">App</span><span class=\"mtk1\">;</span></span></code></pre>\n<h3 id=\"add-landing-page\" style=\"position:relative;\"><a href=\"#add-landing-page\" aria-label=\"add landing page 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>Add Landing Page</h3>\n<p>In your <code>components</code> folder under the <code>src</code> folder, create a <code>src/components/LandingPage.js</code> file and add the following code to navigate your Register/Login buttons to the following URL's as shown below.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;../config.js&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk11\">LandingPage</span><span class=\"mtk1\"> = () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">h1</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\"> React Demo App </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">h1</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">a</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">href</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk8\">`https://</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">APP_NAME</span><span class=\"mtk4\">}</span><span class=\"mtk8\">.hub.loginradius.com/auth.aspx?action=register&return_url=</span><span class=\"mtk4\">${</span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk4\">}</span><span class=\"mtk8\">/login`</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">Register</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">a</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">a</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">href</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk8\">`https://</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">APP_NAME</span><span class=\"mtk4\">}</span><span class=\"mtk8\">.hub.loginradius.com/auth.aspx?action=login&return_url=</span><span class=\"mtk4\">${</span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk4\">}</span><span class=\"mtk8\">/login`</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">Login</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">a</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk12\">LandingPage</span><span class=\"mtk1\">;</span></span></code></pre>\n<p>By doing this, we are redirecting our application to the <strong>LoginRadius Auth Page</strong> and are passing the <code>return_url</code> as the current origin. After successful login, the <strong>Login</strong> component fetches the user profile data as shown in the following step. However, <code>return_url</code> can also be your website, backend server, etc., where you can handle the access token to perform different actions. </p>\n<h3 id=\"add-login-component\" style=\"position:relative;\"><a href=\"#add-login-component\" aria-label=\"add login component 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>Add Login Component</h3>\n<p>In your <code>components</code> folder, create a <code>src/components/Login.js</code> file and add the following code to retrieve <strong>User Profile Data</strong>. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">withRouter</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react-router-dom&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;../config&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Login</span><span class=\"mtk1\"> </span><span class=\"mtk4\">extends</span><span class=\"mtk1\"> </span><span class=\"mtk10\">React</span><span class=\"mtk1\">.</span><span class=\"mtk10\">Component</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">constructor</span><span class=\"mtk1\">(</span><span class=\"mtk12\">props</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">super</span><span class=\"mtk1\">(</span><span class=\"mtk12\">props</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">state</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">userProfileResponse:</span><span class=\"mtk1\"> </span><span class=\"mtk4\">null</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    };</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">componentDidMount</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">token</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">new</span><span class=\"mtk1\"> </span><span class=\"mtk10\">URLSearchParams</span><span class=\"mtk1\">(</span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">props</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">search</span><span class=\"mtk1\">).</span><span class=\"mtk11\">get</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;token&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">token</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk11\">fetch</span><span class=\"mtk1\">(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&quot;`https://api.loginradius.com/identity/v2/auth/account?apikey=&quot;</span><span class=\"mtk1\"> +</span><span class=\"mtk8\">`</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          config.API_KEY,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          method: &quot;GET&quot;,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          headers: {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">            Authorization: &quot;Bearer &quot; + token,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          },</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">      )</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        .then((res) =&gt; res.json())</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        .then((res) =&gt; {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          this.setState({ userProfileResponse: res });</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        })</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        .catch((e) =&gt; {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">          console.log(e);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        });</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">    } else {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">      window.location.assign(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk8\">        `</span><span class=\"mtk12\">https</span><span class=\"mtk1\">:</span><span class=\"mtk3\">//${config.APP_NAME}.hub.loginradius.com/auth.aspx?action=login&return_url=${window.location.origin}/login`</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">render</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">userProfileResponse</span><span class=\"mtk1\"> } = </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">state</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">span</span><span class=\"mtk1\"> </span><span class=\"mtk12\">style</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">{ </span><span class=\"mtk12\">whiteSpace:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;pre-wrap&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">textAlign:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;left&quot;</span><span class=\"mtk1\"> }</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk4\">{</span><span class=\"mtk10\">JSON</span><span class=\"mtk1\">.</span><span class=\"mtk11\">stringify</span><span class=\"mtk1\">(</span><span class=\"mtk12\">userProfileResponse</span><span class=\"mtk1\">, </span><span class=\"mtk4\">null</span><span class=\"mtk1\">, </span><span class=\"mtk7\">4</span><span class=\"mtk1\">)</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">span</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk11\">withRouter</span><span class=\"mtk1\">(</span><span class=\"mtk12\">Login</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>The Login component will call the LoginRadius API to fetch the user data by making use of the <code>token</code> obtained upon logging in via the <strong>LoginRadius Auth Page</strong>. </p>\n<h3 id=\"add-logout-component\" style=\"position:relative;\"><a href=\"#add-logout-component\" aria-label=\"add logout component 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>Add Logout component</h3>\n<p>In your <code>components</code> folder, create a <code>src/components/Logout.js</code> file and add the code as shown below.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;../config.js&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Logout</span><span class=\"mtk1\"> = () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">removeItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;token&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;container&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">a</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">href</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk8\">`https://</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">APP_NAME</span><span class=\"mtk4\">}</span><span class=\"mtk8\">.hub.loginradius.com/auth.aspx?action=logout&return_url=http://localhost:3000/`</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">Logout</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">button</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">a</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Logout</span><span class=\"mtk1\">;</span></span></code></pre>\n<p>This component contains logout functionality. Here, <code>action=logout</code> is passed to the <strong>LoginRadius Auth Page</strong>, which will log the user out and return them to the Landing Page specified in the <code>return_url</code>. </p>\n<blockquote>\n<p>Full code of the demo can be found on <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/React/react_auth_demo\">github</a>.</p>\n</blockquote>\n<h3 id=\"testing-the-application\" style=\"position:relative;\"><a href=\"#testing-the-application\" aria-label=\"testing the application 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>Testing the application</h3>\n<p>Run the React Application from the command line using <code>npm start</code>. You will be able to see the output on <code>localhost:3000</code>. You can also directly open the IDX page on <code>https://&#x3C;LoginRadius APP Name>.hub.loginradius.com/auth.aspx?action=register&#x26;return_url=http://localhost:3000/login</code>.</p>\n<p>Congratulations! You have set up a React Application configured with LoginRadius using LoginRadius CLI. Continue reading to check out some cool and advanced features of the LoginRadius CLI that will help you manipulate and configure the LoginRadius Auth Page for your application through the CLI. </p>\n<h2 id=\"advanced-loginradius-cli-features\" style=\"position:relative;\"><a href=\"#advanced-loginradius-cli-features\" aria-label=\"advanced loginradius cli features 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>Advanced LoginRadius CLI features</h2>\n<p>This section explains the use of the LoginRadius CLI in enabling users to quickly and efficiently make changes to the <strong>LoginRadius Auth Page</strong> configured for their application. </p>\n<h3 id=\"adding-social-login-methods\" style=\"position:relative;\"><a href=\"#adding-social-login-methods\" aria-label=\"adding social login methods 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>Adding Social Login Methods</h3>\n<p>We can add social login methods like Google, Facebook, etc., to the LoginRadius Auth Page using the CLI. Use the <code>lr add social</code> command to add a Login method and the <code>lr get social</code> command to view the current active social login methods. Check the image below for a visual representation. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 70.3076923076923%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAABYlAAAWJQFJUiTwAAACJ0lEQVQ4y52TyY7TMBjHvSRx7NhZmqQtXWY6HcQiNAfEQ3DiZbhxgEFC3BGaHgAxB15jEK+CuthOB9QyPAGf23TUViO2w0+243z//L8lyPf9x5zz15TS5wihF8Dp9ooxPpVSvnS4fX23j4t9BTxB8NIbSugPOEwBDZhtMMJGCGF5GFq337+vcbEL4L0TfBtE4TxMozHP46kvwgnCaIwJmWCCx5iSCXKrByvGYwi6ia+ABT4A6Czrlcv8Ts9mg3aVDlpV3C1sctCs4l5R8SQyTAkTlYmlgecymNWZbJjVDi+B85WgKtNFebdvVZ7YQHETggjPlAlTaZgUpg76HbuCURYvkn5pkk5hwzgCIXAVi5Wgg1Ci91zd5PDbtSBh3nfKA6gfMx5nmjJfE0gPnmvsUw011X9wOLl2SAkZFd3Wshx2TQNqKNuZZeBSFonN2oVNm7kN1dqtz5kJM7kqCXO4bACRx5p4dO0wYMHo3qOTq/sPT2xx2KmKB4dz0WlYVaRmcHtYHRwNKs/3XICGjmtS77eBZk0hi7UgpDaS/WKZDFtGZLGRvjCKBiZCnmYI679oyG5TqO+N1K18kfabOu7mNoqEySJlGjK2pUysENy4OpIaNzqEkO3x2RUEh2eN485C5ek0aXagNlL7MpwFsdAO3lAa6qeZOyuuYZw0lGAjssEN9xz46Lr8Dv6In7BWCOHL+kv/CsSiK+CTE3wKfAEugM//yUWt8ewXEr/6RdvxeekAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Facebook Login Added\"\n        src=\"/static/cc40ce7cc44ddebce1f77e1e56f6c20a/e5715/lr_social.png\"\n        srcset=\"/static/cc40ce7cc44ddebce1f77e1e56f6c20a/a6d36/lr_social.png 650w,\n/static/cc40ce7cc44ddebce1f77e1e56f6c20a/e5715/lr_social.png 768w,\n/static/cc40ce7cc44ddebce1f77e1e56f6c20a/c8ad9/lr_social.png 1564w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<p>After adding the new login method (in this example, it is Facebook), navigate to the LoginRadius Auth Page by using the <code>lr demo</code> command.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 60.92307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAACXBIWXMAAAsTAAALEwEAmpwYAAACTklEQVQoz12Ry2sTQRzHt22aZrPNzCTZV7b7SDbJbrI23TzagvZWEbWCRbEgFQQPnvoXeBQvgtA8dpPmoBTBk6IgKOpRPPbgH2ERxYOCGFEzs86uBh/Dhzn84MN3vr9hFqvOYs2tN1rN1opbb1YqjlW2i07DWDltrJyi5P/i18RaO9s8ub14fIvRFxTLstScnM1k4rFYqZBfdR1ncwd2v6HOiALbIzABRpN0d5TpfU13Roxbqxm6bugaz2cLhrG8vGoZirh2EQ4C6I+BN+YHWBliaQ/nhjjTx8DHkOKFN1NbciEAsZmZVJItF01N01Fimj+6RWXkj7neuLqPNx7iEw/w+n3s7EfmBGbJrdtFk43PUplHUJYVTUD6+pUoGQMPCwOSG5LsgCS6ZGqXcD2CfAIjmEaTnlbRNA1NlbNIlnOGmEatc1EyZrtk+R6++mK8/ZRQLj8jlX2SnPhMuWAUDF0SeB6mbNOQRYGbYmBzk8q04cwuvvScHHwIXh4Grw6Dg3fBxiMSa5N0P5JNfUGVBMjGubm4JotO2SxJKXUt7Ey3khoEys3DIzde1+6GmaU7RNwjwJs8u+66FcsS0wAk4rqqlUq2Allh9TzaC2XYD+Ctj/PX33BeQB1aGEwKR3KjWSkWRJRCyTmJ5y3Lnp9muMYmlZGHOT+ott9ee/J+5/En3v+B+n+2FcqOTf9VoqYAkhkwb5dLOpxla2d+b9sPhM6X6vBz9fZ3FH4Pgf8ku428pvKpRC4D8oqkKnJZYJVjF0Akh36fsF7A9oL/TMpPz0IKW6ETzF8AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Facebook Login Added on IDX\"\n        src=\"/static/95db8a5404c417af55e16f947fa3e4a7/e5715/add_login.png\"\n        srcset=\"/static/95db8a5404c417af55e16f947fa3e4a7/a6d36/add_login.png 650w,\n/static/95db8a5404c417af55e16f947fa3e4a7/e5715/add_login.png 768w,\n/static/95db8a5404c417af55e16f947fa3e4a7/60708/add_login.png 2872w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<h3 id=\"updating-the-theme\" style=\"position:relative;\"><a href=\"#updating-the-theme\" aria-label=\"updating the theme 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>Updating the theme</h3>\n<p>We can update the <strong>theme</strong> of the LoginRadius Auth Page using the <code>lr set theme</code> command. You can use the <code>lr get theme</code> command to get a list of all available themes and the currently active theme. See the image below for visual representation. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 81.07692307692308%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAABYlAAAWJQFJUiTwAAABg0lEQVQ4y52UXU7CQBCAt0u73V/KUkQS33zwLHoogg96AGIk8UZi4hkM0O5ioMgRnKnFAAEtPHyd7nbn2+lOWhKG4R0X4hFinxAyKAmqCARBMJBS3iN4/7tmF8x9AG4JpXTYoHQNgxmQb+EQeO6MMXMQehC6zfwemPsFDAHyxIz8FGlzorqtmTBqqiFGMp7Cs0lNPoA5ulA44okqVNfmutf2yhpnIIIQd872qj4ErsHNl+gqhXEiC9lJMnVpve4knkm+LctqsCuUbbuy1z0XcpbHTelCFuU1KsuPCOlI2XSV3ly5MI7qVvR3hbypCmFNBk3xXAkn06aHJnmmxc+rB0G+IYDKKIFYjo+coUz0Cs9QtI1TF4nHWAINwuYwIxw0zjE4DhMLlzLltFKO8uiwkMXxUhmT0bCR7xA18rO6DFUUvKUzbrXDpmBEBHDWGQKLavLQ4lO7XF6WW8JjSbUrfP6nwrrCReUiL8C6+sjnZ+IqB7rKX8878AqMgbcTGVe56Oh/A9VBFD6Xc+bWAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Theme changed to Tokyo\"\n        src=\"/static/84b4b1478e671e85af02ea1800ddc4b6/e5715/lr_theme.png\"\n        srcset=\"/static/84b4b1478e671e85af02ea1800ddc4b6/a6d36/lr_theme.png 650w,\n/static/84b4b1478e671e85af02ea1800ddc4b6/e5715/lr_theme.png 768w,\n/static/84b4b1478e671e85af02ea1800ddc4b6/891d5/lr_theme.png 1520w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<p>After changing the theme, navigate to the LoginRadius Auth Page using <code>lr demo</code> command to view the changes. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA6klEQVQoz2OQ0jL9L6lp8l9a2wxMi6kZ/hcnEYupGfyX1TH/LwPEDMJqRv/BWBVCi6gbY2BRKBbBg4VVDcFmMIgiaQBjoKFgDFUkCXS5sZPPf1VTx//iGib/RcByRgh1SOpBGNNAJCykYvhfzczpv4V74H9zt4D/yib2YEvw6cFqoAjchRBazdzpv6qZI1gcJieC5CqCBiIbHJac87+kvu1/UW0LmI3LIKINzCmv/z9t3mIgXvI/r7IR7mqyvCyiavCfT93yv6RHzn9RDdP/vAo68Fgn2cuw8BIDxiwypsjL6C4hZBhRBpKKAdIzRNK8IlIjAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"New Theme Tokyo\"\n        src=\"/static/614434594406fb262981bbdf7a033839/e5715/set_theme.png\"\n        srcset=\"/static/614434594406fb262981bbdf7a033839/a6d36/set_theme.png 650w,\n/static/614434594406fb262981bbdf7a033839/e5715/set_theme.png 768w,\n/static/614434594406fb262981bbdf7a033839/29114/set_theme.png 1920w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<h3 id=\"adding-to-the-registration-schema\" style=\"position:relative;\"><a href=\"#adding-to-the-registration-schema\" aria-label=\"adding to the registration schema 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>Adding to the Registration schema</h3>\n<blockquote>\n<p>This functionality is only available for paid <strong>Developer Plans and above</strong> (not available for LoginRadius Free plan). </p>\n</blockquote>\n<p>We can update the Registration Page schema using the <code>lr add schema</code> command. Use the <code>lr get schema</code> command with <code>--active</code> or <code>--all</code> flags to get the current Registration fields or view all available fields with their schemas. You can also configure addtional features by choosing the <code>setup advance configuration</code> option.<br>\nSee the image below for a visual representation of the command flow. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 101.38461538461539%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAABYlAAAWJQFJUiTwAAAB+0lEQVQ4y52SW3LaMBSGdbF8l+9ACEynmUzabWRHfUoXkYc+ZKbu4ppCE5DkTCBkCf0FfqCUmotnPoM11uej/xzCGb93hWgooT8JIb92YYxNsiz7LaWcUkon+94Bdq8B94A8ME80PHCnIvafHVc8cc6fsH4Kk1b4QCghddEvV+W4r4uri6a8vmyKq2GTjntNnEqTFKkJ0kjHg9z4MtQeCMvEuHGgIZgDBZ7BAtSEcVZng2KV5uk8LnKTfug3YS8xjhBKML6GbjbNO9gSOrzOrofvEKk465kw7BlGxT6BOkpobzJP36JUzimnijNPOY6vtiSH+FcoPHchAm8mIl8zwQ4dr7tCjEsd97I3eVmqZFSZCOF7ySZ4H80I8lj72QbbEDcKtId1S4B3ROjpvzNkrE4uipUcVWthhu5CbsJc6rBKjSUeFibCsyMcRTlTyH0Nb593KsTYDKpV+Xmsq5vxixXmGBtpJajWxhBAFhT4QBJpRKM7j4yv1Jg722VtR6a8Gb3kHzGPnyAfViYZFCZMY93RpJ0MGa2RwxLMROhrW5HFDq4rkRfytL//Ee4fG/DaLnZ1Uu387xQutoRd83Z0hYudCtUJQ32U8PzBxvX9yAwPCV9bF/kBlmDWHkOfiGr3LlsX+dYuPoLpmTy2Dusit+ALuANfz+Suddz+AQRLYaR/52B7AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Get and Add to Reg. Schema\"\n        src=\"/static/1c94f8eb16492c0df93ff90860e88db3/e5715/lr_schema.png\"\n        srcset=\"/static/1c94f8eb16492c0df93ff90860e88db3/a6d36/lr_schema.png 650w,\n/static/1c94f8eb16492c0df93ff90860e88db3/e5715/lr_schema.png 768w,\n/static/1c94f8eb16492c0df93ff90860e88db3/891d5/lr_schema.png 1520w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<p>In the below image 2 fields have been added to the registration schema, <code>Confirm Password</code> and <code>Gender</code>. To view the changes, navigate to the LoginRadius Auth Page using <code>lr demo</code>command.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAABPElEQVQoz2OQ0jL9L6lp8l9a2wyIQWxjMBZXN/ovrmb4X0zV4L+Qku5/ERX9/2JAvjgaBoupG/6X07X4Lw00i0FYzeg/GKtCaBEoX0TdGEyLa5n9V7dw/i9vYPNfTMMEKG8MlkPBQDEhVUOwegZRoAAuLAxUJKNn+d/AwQtsqJSOOdhCsDyIhmF1I7gevAYKqRj+VzVz/G/pEfTfyjP4v7KJPdgSfHrwGghyjZSu5X8tG/f/2rYe/yV1LPAaRtBAULjWNXX8X71qLRCv+9/Q0km+C0GBDYrh3Rs3/X//7PH/jy+f/d+3ZStYTIRsA4Fe9nD3/R+b1/Q/OrsWyPb5LwaVI8lAWEyCNHLLaPzn13P7z6ft+J9LRh0ew/DYJtqFUE3imqZAb+oBsT6YLQJNo2RFCsK1JmCMy1XIGAAOmUzLlrV7JwAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"alt_text\"\n        title=\"Added Fields\"\n        src=\"/static/974028afb0b77e477add1109ab24a1a3/e5715/add_schema.png\"\n        srcset=\"/static/974028afb0b77e477add1109ab24a1a3/a6d36/add_schema.png 650w,\n/static/974028afb0b77e477add1109ab24a1a3/e5715/add_schema.png 768w,\n/static/974028afb0b77e477add1109ab24a1a3/29114/add_schema.png 1920w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span> </p>\n<blockquote>\n<p>Instead of using the <code>lr demo</code> command, you can also view the <strong>LoginRadius Auth Page</strong> by visiting locahost:3000 and following the same workflow as explained earlier.</p>\n</blockquote>\n<p>The entire description for these commands can be found in the <a href=\"https://www.loginradius.com/open-source/cli/manual\">LoginRadius CLI Manual</a>.</p>\n<h2 id=\"contributing-to-loginradius-cli\" style=\"position:relative;\"><a href=\"#contributing-to-loginradius-cli\" aria-label=\"contributing to loginradius cli 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>Contributing to LoginRadius CLI</h2>\n<p>The <a href=\"https://github.com/LoginRadius/lr-cli/\">LoginRadius CLI</a> is open-sourced under <a href=\"https://github.com/LoginRadius\">LoginRadius Organization</a>. You are welcome to contribute to it, suggest improvements, or report bugs by following the contributing guidelines. You can also checkout our <a href=\"https://www.loginradius.com/open-source/\">open source page</a> if you wish to contribute to other opensource projects by LoginRadius.</p>\n<h2 id=\"your-take\" style=\"position:relative;\"><a href=\"#your-take\" aria-label=\"your take 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>Your Take</h2>\n<p>Using the LoginRadius CLI, you can easily setup authentication for your React applications. You can also perform certain LoginRadius functionalities and processes efficiently through the CLI, which saves a bunch of time. LoginRadius will handle all the authentication-related mechanisms so that you can solely concentrate on your application development.</p>\n<p>I hope you enjoyed this tutorial and found it to be useful. You can provide feedback or suggestions in the comment section below. </p>\n<p>Cheers!!!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"date":"May 12, 2021","updated_date":null,"title":"Implement Authentication in React Applications using LoginRadius CLI ","tags":["Authentication","React","CLI","LoginRadius CLI"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/ebd0bed97181739f12158e74609a96c6/14b42/cover.jpg","srcSet":"/static/ebd0bed97181739f12158e74609a96c6/f836f/cover.jpg 200w,\n/static/ebd0bed97181739f12158e74609a96c6/2244e/cover.jpg 400w,\n/static/ebd0bed97181739f12158e74609a96c6/14b42/cover.jpg 800w,\n/static/ebd0bed97181739f12158e74609a96c6/47498/cover.jpg 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Akash Patil","github":"Akash-Patil","avatar":null}}}},{"node":{"fields":{"slug":"/engineering/implementing-authentication-in-angular-2-plus-with-loginradius-cli/"},"html":"<p>Hello Guys!!!, today we will be implemented the authentication in the Angular 2+ application within 5 mins using <a href=\"https://accounts.loginradius.com/auth.aspx?return_url=https://dashboard.loginradius.com/login\">LoginRadius</a>.</p>\n<h2 id=\"configuring-loginradius\" style=\"position:relative;\"><a href=\"#configuring-loginradius\" aria-label=\"configuring loginradius 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>Configuring LoginRadius</h2>\n<p>To implement authentication in the angular app first let's start with registering in the Loginradius and creating the application using <a href=\"https://github.com/LoginRadius/lr-cli\">LoginRadius CLI</a>.</p>\n<h3 id=\"why-loginradius-cli\" style=\"position:relative;\"><a href=\"#why-loginradius-cli\" aria-label=\"why loginradius cli 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>Why LoginRadius CLI</h3>\n<p>Developer Experience plays a crucial role for us. We always think about the ways we can minimize the juggling between a quickstart tutorial, dashboard, and terminal. The LoginRadius CLI will simplify your flow by just using some simple commands to register, create an application, log in, etc., and enables you to get the job done in very little time without leaving the terminal.</p>\n<h3 id=\"loginradius-cli-setup\" style=\"position:relative;\"><a href=\"#loginradius-cli-setup\" aria-label=\"loginradius cli 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>LoginRadius CLI Setup</h3>\n<h4 id=\"mac-or-linux\" style=\"position:relative;\"><a href=\"#mac-or-linux\" aria-label=\"mac or linux 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>Mac or Linux</h4>\n<ul>\n<li>\n<p>Install the tap via:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ brew tap loginradius/tap</span></span></code></pre>\n</li>\n<li>\n<p>Then, you can install LR CLI via:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ brew install lr</span></span></code></pre>\n</li>\n</ul>\n<h4 id=\"other-platforms\" style=\"position:relative;\"><a href=\"#other-platforms\" aria-label=\"other platforms 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>Other Platforms</h4>\n<ul>\n<li>Download packaged binaries from the <a href=\"https://github.com/loginradius/lr-cli/releases/latest\">release page</a>.</li>\n</ul>\n<p>After installing the CLI, you can register into the LoginRadius via the below command.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"sh\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$ lr register</span></span></code></pre>\n<p>This command will open the Loginradius in the browser to register yourself and create the app.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 60.92307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAABYlAAAWJQFJUiTwAAACC0lEQVQoz5WSW3PSUBRGU6fVUq3UC7XaqSjXpNxSLJdgCgFpba2X6tjfruNTI0P70IEmBEwQyOc+J8BAeTIz3+zkkLOy9uYIudwbKOUaKlodZUpa3kc0nkBMTFISSKZkpDNZXkUpuRBpN4WMTAxFRS6vQPCLKu6HC3gQLcIfL8EvvsWGpNKzghd7dfz4+QvNZhO6/hsXF/o0uk5V92qj0cDl5RWvwqpUxZZyBr98jDsxDcuvi1gJl7D0qoDA3hFsp4//uYSHyRoi2jmi2ncE1W94WfyIncIpnmTq2CSgYVr8xeFwCNPqon1jwrYdvua6Ls9oNJpG8Cc0hNQviJS/Ikw1pJ5hM3uEtfgBBzLIZHPLMHF13UK7Y8H+O8BgQKEPeb977wjruxVs50/J7BMep9/BF1NxL1Lird8Gts0umtc3ZN2BSVDDNGF1e3O2go9MtvaPeatPqU1mxrISUuaAI0+B3zuOjX7fm61LbbrjdQ8YO0BQ+Qyxes7nxuyY5XJo0XA43mx2OuiSGV+jlueAzOZ57oQbbuc/YCNZBRvDXQIHbgEng+/ZffT+2NPnOeC6VKGNh2B/zqNUjYfNkoGfZd/PAXnrBHDoKLHjxO5n58ePDQMyM9YuqwzGoDsFz9joWDObFs+dO7M4nqFKdlXPjLJGH/BJGpaCeQTkwwXDic1kBOwyDAOtVovf/wOvtKhoUmY20gAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Register Page\"\n        title=\"Register Page\"\n        src=\"/static/f7b929e780c62f831dea548530d792e3/e5715/resgister_page.png\"\n        srcset=\"/static/f7b929e780c62f831dea548530d792e3/a6d36/resgister_page.png 650w,\n/static/f7b929e780c62f831dea548530d792e3/e5715/resgister_page.png 768w,\n/static/f7b929e780c62f831dea548530d792e3/d9ed5/resgister_page.png 2880w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Once you successfully register you will be able to see the below message on the browser, you can close the tab and come back to the CLI.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">You are Successfully Authenticated, Kindly Close this browser window and go back to CLI.</span></code></pre>\n<h3 id=\"get-your-application-api-credentials\" style=\"position:relative;\"><a href=\"#get-your-application-api-credentials\" aria-label=\"get your application api credentials 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>Get Your Application API Credentials</h3>\n<p>Once you <strong>login/register</strong> using the CLI, You can now run the <code>lr get config</code> command to get your API credentials. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 40%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAABYlAAAWJQFJUiTwAAABXElEQVQoz53RzU6DQBAH8Nldln7AQoECBSytHH0SD8Z69QX06NdRjc9h4tFEX8hUW6LWlgVLfAeHBpPG9NTDLzPZ2fknmwUAiAkhh5TSEfZHWxjVDlAIGHbSarU+hBBjxtgrHq4bm6Y5CYIg9Txvqmna27/56g56QRN0jOAKvdfD6X+KoqRcVVOF8xRfkW66s7Z7WgVeswbLFE2dNTqtBReNRds1MqrSBc6+1sw3+Jt9ohk6qwJvhRV+u70k88OksL24cPpJ4WDVhZvrvU7O/SgnwpZWsylF1M3bjpG3vU5uh26hMTWrw6rgiyrwRtcj6ZjDedeIpaFHma4HmeMMpIU6cVeq/USy4V6u2n7m2pa0dwNp7LjSGvjSilHozgVvVoHnVeAdAPnBz8kJoUvsS+wRXQECCCtXS6CsJABLqmClpISq56xkXCkoENyFS6i//gE9ouctPNW792j/F0p7gNt6dwoRAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"LoginRadius CLI Get Config\"\n        title=\"LoginRadius CLI Get Config\"\n        src=\"/static/a473438676d4734d4d95e8b084db1f16/e5715/lr_get_config.png\"\n        srcset=\"/static/a473438676d4734d4d95e8b084db1f16/a6d36/lr_get_config.png 650w,\n/static/a473438676d4734d4d95e8b084db1f16/e5715/lr_get_config.png 768w,\n/static/a473438676d4734d4d95e8b084db1f16/dd104/lr_get_config.png 1064w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"configuring-callback-urls\" style=\"position:relative;\"><a href=\"#configuring-callback-urls\" aria-label=\"configuring callback urls 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>Configuring Callback URLs</h3>\n<p>A callback URL is a URL in your application where LoginRadius redirects the user after they have authenticated. The callback URL for your app must be added to your Application Configuration. If this field is not set, users will be unable to log in to the application and get an error.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 49.69230769230769%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABYlAAAWJQFJUiTwAAABR0lEQVQoz62S23KCMBCGef/H6sFqKVwiAiYBZMLBKiDi2b/ZbR31qnWmO/Oxm+zkzy5Za7fboWlatG2LruvY13Vt9hpQ7ng8/onD4cBYdKjIC8zncyyXtfGfmM1mzGazwSPGgvTReQ6lFGIVI0lSLBYLhi4jO5/Pd/7ObvZYcL/fI0lTBEGAMAgRhiHKskJVVVwhiVzaOp1Ov7ZtUdC2DbeYGuE4jploOoWUEuPxmC9TUsH3fc4J8Z2TQnIRQgh0qxWLWnRrURRwHAe2bWM0smG/O3A+XDw/veLF4JrYdVwMBm/cQa419A+5zvl83/dXwbIsMRyODEMEkxDK1xBexkhPQ4kEE1MlVRVFETzP46qCYGIIkcQJ/x4WpL5pRLIs40ehken7NdbrznDrr1A1t2satztBek16HIq32y0nH+Vy3roM5H/xBU+R+aSCVKLIAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Whitelist domain error\"\n        title=\"Whitelist domain error\"\n        src=\"/static/d1d9601855b3d84f38f961c307c7958b/e5715/whitelist_domain_error.png\"\n        srcset=\"/static/d1d9601855b3d84f38f961c307c7958b/a6d36/whitelist_domain_error.png 650w,\n/static/d1d9601855b3d84f38f961c307c7958b/e5715/whitelist_domain_error.png 768w,\n/static/d1d9601855b3d84f38f961c307c7958b/00172/whitelist_domain_error.png 1044w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>To get the list of whitelisted domains, you can run <code>lr get domain</code> command from the cmd prompt. And to add a domain in the list using <code>lr add domain</code> command. </p>\n<blockquote>\n<p>If you are following this tutorial, you should set the  <code>http://localhost</code> as a whitelisted domain. Check the below image for how to add the domain using LoginRadius CLI.</p>\n</blockquote>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 45.230769230769226%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAABYlAAAWJQFJUiTwAAABWElEQVQoz53RzU7CQBAH8G1pAt1+7G4XSlkggBAS44PwDqAXvXtEnsI7B9/LQAXB7m6rL+G0WY0hHtDDL5NOd/6dtgghNLJte16r1RaWZV3D9c0flTMLMC+zEITcua57CIJg4zjOFpoby0KbspYIIS9CiF2r1drBmfSrf+IZ7MEtQPcgNc3tKdg8hQdV4E22v50xs6nJQst63c6w5xwi1pCM1mVX+ApjJ4N7b2fam7osA1dJSPQkbsu4Geq4RfJOQnJKPe37nobPUVKEBhp7rg5DX9u2JWEu++Fg6qoK5ATrXptkgz7NhwOaT8e84AzrbjvMry7jYthj+SQWhWA8Z4zkTU4rGDcUzMvTwIcmd6UQ/nE6Znp8QXU/pmoUxYoFnkwSpjtJpFkQKOJ7EjZUUUQU51QxFlbgx75CzvF7Q/ABNCjAe8ky9UzaZFSBM/AI1uDpn9YmY/YJItCUJ5C8j5gAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"LoginRadius CLI Add Domain\"\n        title=\"LoginRadius CLI Add Domain\"\n        src=\"/static/8473d7ec2aa6a7836c5d621070194fc5/e5715/lr_add_domain.png\"\n        srcset=\"/static/8473d7ec2aa6a7836c5d621070194fc5/a6d36/lr_add_domain.png 650w,\n/static/8473d7ec2aa6a7836c5d621070194fc5/e5715/lr_add_domain.png 768w,\n/static/8473d7ec2aa6a7836c5d621070194fc5/1ff84/lr_add_domain.png 1040w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"setup-angular-application\" style=\"position:relative;\"><a href=\"#setup-angular-application\" aria-label=\"setup angular application 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 Angular application</h3>\n<p>You can implement the LoginRadius authentication in your existing Angular application, or you can start from scratch by following <a href=\"https://angular.io/guide/setup-local\">this tutorial</a>.</p>\n<blockquote>\n<p>You need to enable the routing for this tutorial if you are not aware of how to enable routing in the angular application, kindly follow <a href=\"https://angular.io/guide/router\">this tutorial</a></p>\n</blockquote>\n<ul>\n<li>\n<p>Create <code>src/app/config.ts</code> and add the below application configuration</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">APP_NAME:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;&lt;&lt;Your App Name&gt;&gt;&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">API_KEY:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;&lt;&lt;Your API Key&gt;&gt;&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk15\">default</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\">;</span></span></code></pre>\n</li>\n</ul>\n<h3 id=\"add-login-to-your-application\" style=\"position:relative;\"><a href=\"#add-login-to-your-application\" aria-label=\"add login to your application 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>Add Login to Your Application</h3>\n<p>If you have already created the login component, add the following code in the <code>.ts</code> file else, generate the login component using ng CLI <code>ng generate component login</code>. Which will create a component inside the <code>app</code> folder. Add the following code to the <code>login.component.ts</code></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Component</span><span class=\"mtk1\">, </span><span class=\"mtk12\">OnInit</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/core&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">ActivatedRoute</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Router</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/router&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;../config&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">Component</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">selector:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;app-login&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">templateUrl:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./login.component.html&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">styleUrls:</span><span class=\"mtk1\"> [</span><span class=\"mtk8\">&#39;./login.component.scss&#39;</span><span class=\"mtk1\">],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">LoginComponent</span><span class=\"mtk1\"> </span><span class=\"mtk4\">implements</span><span class=\"mtk1\"> </span><span class=\"mtk10\">OnInit</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">constructor</span><span class=\"mtk1\">(</span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">route</span><span class=\"mtk1\">: </span><span class=\"mtk10\">ActivatedRoute</span><span class=\"mtk1\">, </span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">router</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Router</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">route</span><span class=\"mtk1\">.</span><span class=\"mtk12\">queryParams</span><span class=\"mtk1\">.</span><span class=\"mtk11\">subscribe</span><span class=\"mtk1\">((</span><span class=\"mtk12\">params</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">params</span><span class=\"mtk1\">.</span><span class=\"mtk12\">token</span><span class=\"mtk1\"> || </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">)) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">setItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">params</span><span class=\"mtk1\">.</span><span class=\"mtk12\">token</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">router</span><span class=\"mtk1\">.</span><span class=\"mtk11\">navigate</span><span class=\"mtk1\">([</span><span class=\"mtk8\">&#39;/profile&#39;</span><span class=\"mtk1\">]);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">href</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">`https://</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">APP_NAME</span><span class=\"mtk4\">}</span><span class=\"mtk8\">.hub.loginradius.com/auth.aspx?return_url=</span><span class=\"mtk4\">${</span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">origin</span><span class=\"mtk4\">}</span><span class=\"mtk8\">/login`</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    });</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">ngOnInit</span><span class=\"mtk1\">(): </span><span class=\"mtk10\">void</span><span class=\"mtk1\"> {}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Here we are redirecting the application to the <strong>LoginRadius Auth Page</strong> where we are passing the <code>return_url</code> as the current origin, so after successful login, the <strong>LoginRadius Auth Page</strong> will redirect to the angular application with <code>token</code> as a query param. Later we will use <code>token</code> for all the user-related actions.</p>\n<h3 id=\"add-profile-page\" style=\"position:relative;\"><a href=\"#add-profile-page\" aria-label=\"add profile page 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>Add Profile Page</h3>\n<p>As you have seen in the above code on successful login, we redirect to <code>/profile</code> page. So let us create a <strong>profile</strong> component using <code>ng</code> CLI <code>ng generate component profile</code>.\nAnd let's modify the <code>profile.component.ts</code> file in the <code>app/profile</code> folder generated by ng CLI.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Component</span><span class=\"mtk1\">, </span><span class=\"mtk12\">OnInit</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/core&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Router</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/router&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;../config&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">ProfileService</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;../profile.service&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Profile</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./profile&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">Component</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">selector:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;app-profile&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">templateUrl:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./profile.component.html&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">styleUrls:</span><span class=\"mtk1\"> [</span><span class=\"mtk8\">&#39;./profile.component.scss&#39;</span><span class=\"mtk1\">],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">ProfileComponent</span><span class=\"mtk1\"> </span><span class=\"mtk4\">implements</span><span class=\"mtk1\"> </span><span class=\"mtk10\">OnInit</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">profile</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Profile</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">loginRadius</span><span class=\"mtk1\">: </span><span class=\"mtk10\">any</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">constructor</span><span class=\"mtk1\">(</span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">configService</span><span class=\"mtk1\">: </span><span class=\"mtk10\">ProfileService</span><span class=\"mtk1\">, </span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">router</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Router</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">token</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">ngOnInit</span><span class=\"mtk1\">(): </span><span class=\"mtk10\">void</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">configService</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getProfile</span><span class=\"mtk1\">().</span><span class=\"mtk11\">subscribe</span><span class=\"mtk1\">(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      (</span><span class=\"mtk12\">data</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Profile</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">profile</span><span class=\"mtk1\"> = { ...</span><span class=\"mtk12\">data</span><span class=\"mtk1\"> };</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      },</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      (</span><span class=\"mtk12\">err</span><span class=\"mtk1\">: </span><span class=\"mtk10\">any</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">err</span><span class=\"mtk1\">.</span><span class=\"mtk12\">status</span><span class=\"mtk1\"> === </span><span class=\"mtk7\">403</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">removeItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">router</span><span class=\"mtk1\">.</span><span class=\"mtk11\">navigate</span><span class=\"mtk1\">([</span><span class=\"mtk8\">&#39;login&#39;</span><span class=\"mtk1\">]);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">logout</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">removeItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">href</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">`https://</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">APP_NAME</span><span class=\"mtk4\">}</span><span class=\"mtk8\">.hub.loginradius.com/auth.aspx?action=logout`</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Similary add the below code to <code>profile.component.html</code> file.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"html\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk1\"> </span><span class=\"mtk12\">class</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;container&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">h1</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">Hello </span><span class=\"mtk4\">{</span><span class=\"mtk1\">{ profile?.Email</span><span class=\"mtk12\">[</span><span class=\"mtk7\">0</span><span class=\"mtk12\">]?.Value }}&lt;/h1&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">  &lt;button (click)=&quot;logout()&quot;&gt;LogOut&lt;/button&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">&lt;/div&gt;</span></span></code></pre>\n<p>The profile component will call the LoginRadius API to fetch the profile details and store them in the <code>profile</code> variable. Using that <code>profile</code>, we are displaying the email in the HTML.\nIt also has the <code>logout()</code> function where we pass the <code>action=logout</code> in the <strong>LoginRadius Auth Page</strong>, which will help us log out the user.</p>\n<p>In the profile component, you can see the two things are used.</p>\n<ul>\n<li>ProfileService - This is the service to fetch the user profile using the token.</li>\n<li>Profile - The model which will be used to store the profile information.</li>\n</ul>\n<p>You can generate the service in the angular using <code>ng</code> CLI by using this command <code>ng generate service profile</code> which will create <code>profile.service.ts</code> with required configuration. Add the below code in the <code>profile.service.ts</code> file.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">HttpClient</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/common/http&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Injectable</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/core&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">config</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./config&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Profile</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./profile/profile&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">Injectable</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">providedIn:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;root&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">ProfileService</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">constructor</span><span class=\"mtk1\">(</span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">http</span><span class=\"mtk1\">: </span><span class=\"mtk10\">HttpClient</span><span class=\"mtk1\">) {}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">getProfile</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk3\">// now returns an Observable of Config</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">http</span><span class=\"mtk1\">.</span><span class=\"mtk11\">get</span><span class=\"mtk1\">&lt;</span><span class=\"mtk10\">Profile</span><span class=\"mtk1\">&gt;(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk8\">`https://api.loginradius.com/identity/v2/auth/account?access_token=</span><span class=\"mtk4\">${</span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">&#39;token&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      )</span><span class=\"mtk4\">}</span><span class=\"mtk8\">&apikey=</span><span class=\"mtk4\">${</span><span class=\"mtk12\">config</span><span class=\"mtk1\">.</span><span class=\"mtk12\">API_KEY</span><span class=\"mtk4\">}</span><span class=\"mtk8\">`</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>We will use the HTTP module to call the Rest API so let's add the <code>HttpClientModule</code> in the  <code>app.module.ts</code> file.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">HttpClientModule</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/common/http&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">...</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">NgModule</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">imports:</span><span class=\"mtk1\"> [</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    ...</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">HttpClientModule</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    ...</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  ],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">AppModule</span><span class=\"mtk1\"> { }</span></span></code></pre>\n<p>Now let's create a <code>Profile</code> model which will be used for storing the user profile. </p>\n<ul>\n<li>\n<p>Add <code>src/app/profile/profile.ts</code></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">interface</span><span class=\"mtk1\"> </span><span class=\"mtk10\">Profile</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">Email</span><span class=\"mtk1\">: {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">Type</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">Value</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }[];</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n</li>\n</ul>\n<h3 id=\"add-routes-for-login-and-profile\" style=\"position:relative;\"><a href=\"#add-routes-for-login-and-profile\" aria-label=\"add routes for login and profile 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>Add Routes for Login and profile.</h3>\n<p>Lets modify the <code>app-routing.module.ts</code> and add the below Routes in it.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">NgModule</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/core&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">RouterModule</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Routes</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/router&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">AppComponent</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./app.component&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">LoginComponent</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./login/login.component&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">ProfileComponent</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./profile/profile.component&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">routes</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Routes</span><span class=\"mtk1\"> = [</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">path:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;login&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">component:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">LoginComponent</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  },</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  { </span><span class=\"mtk12\">path:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;profile&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">component:</span><span class=\"mtk1\"> </span><span class=\"mtk12\">ProfileComponent</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">];</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">NgModule</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">imports:</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">RouterModule</span><span class=\"mtk1\">.</span><span class=\"mtk11\">forRoot</span><span class=\"mtk1\">(</span><span class=\"mtk12\">routes</span><span class=\"mtk1\">)],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">exports:</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">RouterModule</span><span class=\"mtk1\">]</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">AppRoutingModule</span><span class=\"mtk1\"> { }</span></span></code></pre>\n<p>Finally, to gather all, we need to modify the <code>app.component.ts</code> and add the routing logic.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"12\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Component</span><span class=\"mtk1\">, </span><span class=\"mtk12\">OnInit</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/core&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Router</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;@angular/router&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">@</span><span class=\"mtk11\">Component</span><span class=\"mtk1\">({</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">selector:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;app-root&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">templateUrl:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./app.component.html&#39;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">styleUrls:</span><span class=\"mtk1\"> [</span><span class=\"mtk8\">&#39;./app.component.scss&#39;</span><span class=\"mtk1\">],</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">})</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">class</span><span class=\"mtk1\"> </span><span class=\"mtk10\">AppComponent</span><span class=\"mtk1\"> </span><span class=\"mtk4\">implements</span><span class=\"mtk1\"> </span><span class=\"mtk10\">OnInit</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">constructor</span><span class=\"mtk1\">(</span><span class=\"mtk4\">private</span><span class=\"mtk1\"> </span><span class=\"mtk12\">router</span><span class=\"mtk1\">: </span><span class=\"mtk10\">Router</span><span class=\"mtk1\">) {}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">ngOnInit</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">window</span><span class=\"mtk1\">.</span><span class=\"mtk12\">location</span><span class=\"mtk1\">.</span><span class=\"mtk12\">pathname</span><span class=\"mtk1\"> === </span><span class=\"mtk8\">&quot;/&quot;</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">localStorage</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getItem</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;token&#39;</span><span class=\"mtk1\">)) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">router</span><span class=\"mtk1\">.</span><span class=\"mtk11\">navigate</span><span class=\"mtk1\">([</span><span class=\"mtk8\">&#39;/profile&#39;</span><span class=\"mtk1\">]);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">this</span><span class=\"mtk1\">.</span><span class=\"mtk12\">router</span><span class=\"mtk1\">.</span><span class=\"mtk11\">navigate</span><span class=\"mtk1\">([</span><span class=\"mtk8\">&#39;/login&#39;</span><span class=\"mtk1\">]);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>And add the <code>router-outlet</code> to the <code>app.component.html</code> file.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"html\" data-index=\"13\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">router-outlet</span><span class=\"mtk17\">&gt;&lt;/</span><span class=\"mtk10\">router-outlet</span><span class=\"mtk17\">&gt;</span></span></code></pre>\n<blockquote>\n<p>You can find the full code in <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/Angular/angular-authentication-demo\">github</a></p>\n</blockquote>\n<h3 id=\"testing-the-application\" style=\"position:relative;\"><a href=\"#testing-the-application\" aria-label=\"testing the application 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>Testing the application</h3>\n<p>Run <code>ng serve</code> to start the local server, and you will be able to see the output on locahost:4200.</p>\n<h3 id=\"adding-login-methods\" style=\"position:relative;\"><a href=\"#adding-login-methods\" aria-label=\"adding login methods 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>Adding Login Methods</h3>\n<p>You can configure the LoginRadius Auth Page by adding social login methods like Facebook, Google, etc. To add the login method, you can use the command <code>lr get social</code> and <code>lr add social</code> command. Check the below image on how to add the social configuration.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 37.53846153846154%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAABYlAAAWJQFJUiTwAAABQklEQVQoz6XQzVLCMBAA4Py0TZs2bUkbSoGCyMHn8lmcUTz4JjqexIMvo4UkFRnGGX0At9CbcNHDN9tsN5tkEWPsDiF0DW6O4Zwv+krdQt3iVE23v+1ziQihO4qpoZhYSPxCKW1cz2swwUf/dzT4BI9IRHIjmKhj4q4gUTsI7yNFuMYQD9+oJrBG3fqIV/AO7lGpJrsyG5lKDm2RKDvvjZp+UthS5HYiq6ZICzuJlC2j3IZBbKTITRYrEwXCBIzr0I8gl60xxtv9DcdqvJsNz001njfz2UWTJbkp0oHticykkTS9ODMsEYb5vqaEatfxtAcodTSMSzsQPZe1rzo0rJLBdpoU+izMzYBLrYJYD0NppC/a4pXjuGuHuWuYZbvplDewAQ9I8fS7DOVWBLw94eOP2vl9gSeAXsASPP/Dsutz9QNDCI3aHsrqdAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Added Facebook as an loginmethod\"\n        title=\"Added Facebook as an loginmethod\"\n        src=\"/static/c44f54c8139c16bd211fa090ab6b93ea/e5715/lr_add_social.png\"\n        srcset=\"/static/c44f54c8139c16bd211fa090ab6b93ea/a6d36/lr_add_social.png 650w,\n/static/c44f54c8139c16bd211fa090ab6b93ea/e5715/lr_add_social.png 768w,\n/static/c44f54c8139c16bd211fa090ab6b93ea/161ec/lr_add_social.png 1840w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>After adding, visit the LoginRadius Auth Page either by visiting <code>locahost:4200</code> and log out. Or using the command <code>lr demo</code>. You will find the new login method added.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 60.92307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAACXBIWXMAABYlAAAWJQFJUiTwAAACnklEQVQoz4WSy2tTQRSHr03bPO8jTdKbpEljmmfTtM1NWirtRlEUC0WpDyiIILhx4R/gSleC4KNt2loRKeJKRAVB7F6X6r8giIKK4kJc2ObO52Raq125+HEYZs435/zO0apDFaojNRxnjHpjnNFag3K5QrFQJFdxyIwd+Y8OU5icwTk8x/CBU2ipZIK8TE7GbSzTwuPxkM/uZaJWYej4RcwlgbW4oWQubqIvbGJsx/bZaqu5SXippaI2PDxMKt2vFO6JkMn00xgbp5BJ0js1h7EChoTqTUFkRZC4I7BvC+KrgvCyUHf/SquOjKIbFh2dXkIBP/lclj4JN30eIvtOY0qg2WwRWHAZXHM5+tjl0COX/Q9dyvJsNndLG6k5FAcG8HZ1EwwEiVo6vfEEfb1hUgfPYSyjHhpSUVlhr6wuvOTSPS+Tr7vqo7Yt7ft21OqNBvV6g5yE9qdTxHtM4nactB3GbBxTQEsC/DJx7EGL8+st5p4LpbMvBKU1oaCWhClgIdtPNpPGjvYQMwJUBtIkYhGCmobpzCgPw8suHTdanFmHt1/h5QfBq4+CN58F008Enluu8lMBB9JJ2V5EetZJyOshY0ep5TOUbD+pqdntllvoMtpX31O88prqfSH9E+TvucoCfbtdBXScEQYLeWwrhOHtlNNOkyuVSFp+IhMn1FAMCTQlUL/2Dd/ldwSbEJJT98lW29Pf5aHj1BmSbdtmEMvfRUy2myuX8e/R8Dmzf6e8BJWbn7j07AsXnn4n0tzYrsrdgSngULFANhGVMI/00EdED1Aq5EiZHrzVaeVhe8q6fByb/0ll9QeDd3/JJXbV3rWBf2AKOFqrkZU+xkJdJMNB8hKeStjkYn4Skyd31mYLCr5F8C9uLfvWOoldwN+dzfiSXpmaSgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Added Facebook as an loginmethod\"\n        title=\"Added Facebook as an loginmethod\"\n        src=\"/static/e014560a431f67a5a0ce430d7825c6d3/e5715/add_login_method.png\"\n        srcset=\"/static/e014560a431f67a5a0ce430d7825c6d3/a6d36/add_login_method.png 650w,\n/static/e014560a431f67a5a0ce430d7825c6d3/e5715/add_login_method.png 768w,\n/static/e014560a431f67a5a0ce430d7825c6d3/60708/add_login_method.png 2872w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"customizing-theme-for-loginradius-auth-page\" style=\"position:relative;\"><a href=\"#customizing-theme-for-loginradius-auth-page\" aria-label=\"customizing theme for loginradius auth page 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>Customizing theme for LoginRadius Auth Page</h3>\n<p>LoginRadius Dashboard Support three pre-defined themes for you. You can check out the <a href=\"https://dashboard.loginradius.com/auth-page\">Theme Customization</a> section in the LoginRadius Dashboard for all the customization options available. </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 55.38461538461539%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAABYlAAAWJQFJUiTwAAACc0lEQVQoz42SS0iUURiG/yKwVKTsIlI2qakppRAm3kfTyjRFsytILlpYWIsIF0Kbglq0CYqgEjNo06JFm26bCFO8NmVkOqM5hjWOM15m/pn/MuPg03FGQzCoA8/5zuXj5fvOeaXNmRVEZRwm3ngCy+gYTqcDRfMhqz58vr+jL0VF03EpOg6nE6vViizLSJsySolMKyIup4qRsXGmp6exTdqZnXPhUTQ8XlXgRfZ48SzhVRQUVQ2iaiqaruHz+5lzuZGi9x0kIqWAHVnlTNjs/BkLfjEtMs//DrfsQdq4t5j1SXkYcioxi5Y/tLfT0dlJu1Xj7TiYbPP0f/rM+85uOnr6edfRhenLVyyKjY/u7/TKI3TNjTDgnsAliwqjRLthu3NJLKihu89EUmIC0THbib0xREwLlDyZJedQORHx6SRkFhIWt4eyk/VcsbRSP3iXR8MvaRx8QKP5IRMzTqQNyfmsMWQFBXv6TWSkJrFlWyxpt4epfQPVz2RKyipIPmDk3OUmohLTKa2p46IQaB5uAx3uW19xwXyPO30TSOHi/dbuEoKFx+nq7ccQu5XwyCjCGl4j3ZQxtvyi+tRZUvKOYKytx7A/n9PnL9FsecrVocd0TQ9xa/Q5TSNtDNgcKwRFhX2mAWrP1FFcVknR0WryGq5zrfUF8z4dt8eDy+0WP7z4qzqKT0MJiPOAGoz+hQCq1xMSXBefTVz2Maw/fhIIiAvhL5+wgq540VQFv7DESoJ+1EP4dbHXQusZYTUpXLzhYoU7heA386gwdsiHk/YpJqccIjqC+1XYl5kKIc7sIl+KTDUSnlqEIbdqteASi4n/YjnvN106qDqKGufBAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Theme Customization\"\n        title=\"Theme Customization\"\n        src=\"/static/d17d37653b8853673b79b8ba5638a4a5/e5715/theme_custom.png\"\n        srcset=\"/static/d17d37653b8853673b79b8ba5638a4a5/a6d36/theme_custom.png 650w,\n/static/d17d37653b8853673b79b8ba5638a4a5/e5715/theme_custom.png 768w,\n/static/d17d37653b8853673b79b8ba5638a4a5/0b569/theme_custom.png 2878w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>You can also get/set your current theme using LoginRadius CLI by using the commands like <code>lr get theme</code> and <code>lr set theme</code>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 83.6923076923077%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAABYlAAAWJQFJUiTwAAADZUlEQVQ4y12UWXPaVhzFeSugFUmsEkILYhOb2Q1esMc2jhNsJ2kTZ5J43DbpQ9rvk497eq5MU8cPZ5CG0e+ec/733tTy+3fE374h/vsfNL/+heafX9B4+APR/QPqH+/R+PgZ8ecHdPgc/XYH//Yt/OvX8F7ewHuxRW3zErXzK1TX52i8vkOq+eUrjDCEGcdQwjpkP4ASBFB9H3KtBqMewen1YcddmPxfcqqQbariQCrbkEqVRBnTghUPkIoefofc7sAajVEcjVAeT2D2h9C6Axj81VttqPUGF4ugUppQUOeCIVSPC9d8qK6fLJCPhwR+uoczXyK+2KB/do7FdotwdYD66QXKsyW0qAGdwB+gHURxPahVD4pTo1xIxQqsVhep8O4D7OEQ7nwBmy5r0xkK3R4a+0vk6VwlRGNU7YkjAVOqjyARX6lUIRXKMBsdAt9/QGkyR3x2gd7JKfZfbdE+PoXWG9FdM3Gl/RTvGazsQKay+RL7biEV/PoO/nTKqNdoHx0jpNNosUSOMPUJTHkKswmr7GAlO1HWKsIImkj5b96yzBir6xuMzi8g8eMsP9aew/7rizARUd7BRHcy42bNPHJehJR3fcsyW+xshSYlelNEPEoWjp5FFNOUy4+uRG8SowplchZy1ZDAVzfQWKbJbVLkMFrJMLpwBiOEowk0V7j735mIqYiYO2dynrJKyAqg4xN4tUU0W2CyuUTv8Bgzxl5sXqDP5/HxCWq9AULCnXYMr9tH2BuiTjlRC0GHu6G/B68Zw2+2YQmH4ugMD48wPd+gd3CUgHqrQ4zXp+jM92GI6OXHrn5E5ACyJmUUEmcZ3UJayUEruki5Z5cYHBxiKrYNgQNq72iNmJOO9iao011nOkcpbCQweQeUzAIkI58AswRmFB1a3iGQJ2KyPsH+5VXiTMBcRnMZx6S7ND/W2J1WchKgcCYlzvKPIM1EVjWQljSoZgWp6voMHXbYWzEugS266fIo7vG9PZ4hokONg8gIR9bPsOwOlmHcdFaFapSRsldr6NwOhheiEESwagHlc2I1mNx7Je5Febctkr4IyewgGVlPnAn9kpahaAVeDrfveMvMkR+Mef0MYXUGMFuM2+jyKHWg+02YQYvxmzDcCAYnmbMD5MoedA5Bz1ehmzY0g5dDIcC/z6rgYOE1JiEAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Theme Customization CLI\"\n        title=\"Theme Customization CLI\"\n        src=\"/static/ddbce18605c36183916aa2ca85e5cdc4/e5715/theme_cli.png\"\n        srcset=\"/static/ddbce18605c36183916aa2ca85e5cdc4/a6d36/theme_cli.png 650w,\n/static/ddbce18605c36183916aa2ca85e5cdc4/e5715/theme_cli.png 768w,\n/static/ddbce18605c36183916aa2ca85e5cdc4/669eb/theme_cli.png 1244w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"addingupdating-registeration-schema-for-loginradius-auth-page\" style=\"position:relative;\"><a href=\"#addingupdating-registeration-schema-for-loginradius-auth-page\" aria-label=\"addingupdating registeration schema for loginradius auth page 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>Adding/Updating Registeration Schema for LoginRadius Auth Page</h3>\n<p>LoginRadius Auth Page supports 3 predefined fields for LoginRadius Auth Page i.e Email, Password, Confirm Password. With the help of LoginRadius CLI, you can manage the registration schema for your LoginRadius Auth Page. </p>\n<p>Check out the below commands to add the new registration field in your LoginRadius Application. After adding the new schema field you can always check your LoginRadius Auth Page by running <code>lr demo</code> command from the terminal.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 85.38461538461539%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy+AAAACXBIWXMAABYlAAAWJQFJUiTwAAADiUlEQVQ4y02UbXOaaBiF+bRVXgV5FVBARAVFTUxM1FhjTJpM29kmfdnMNL+mf/z0QNLd/XBGGJ3rOefc96Nw+usXspcX9H++IH5+RvLjHyTfviP++g3RlyfEfz8i//GM0dfv6D18RPfuAeHxHuHhDsH+iGB3gH91DW+1Qf/TE4Tel0coSR9GXkAfjaBmQyjpAHKcUDGkXgSN36tRAinsQgxCiH4AseND9Hw03Q6k6tO0YZUnEPo8ffB+j9n9A4qbI+L9DaLtDsHpkjpD72wFt5zBm84QLk4RzOYISorvnWKKYFLCiNMaalfA5PEJy7sPmByPaE+msKdTOAQ40xIO3z0+23Tv5BNYwzGMNIPRH8BIUuhxH3pE92EPkuPBKuYEMnKy3mJ4fYP58RYlXaabLYLlCsHJEt3FCTy6CGcLmIMh5G4EhQA56EL2u5A6AZROCMl2YY5LCCMO4Ixx88MNku2WDkto7FGlE6WfQmZ3ShS/gii1EoEKgYofEhZA9tip5cDMJhCGjLz99Bk5e/SXS7SLCTRG0jgYjbG0+HUgai+uYZU7hc5kulIIkl2/lsihmGlOh1yN5e0dTj/cIzk752T7tVTqD0ypYCFhwX8w+Q0mOR3IdgeiYaGdjCCMuWdLdpddbpCuLjjFBXqcppmNXkF/nL3BlP87q2FerQpoRBmE7ONnFNsrulshnC+gVxNkfxVI+rd4lk6IVEXjNMUKYLloth00DbtWQzNgdFMI0e09svMLzDnlMadd7ZfPqXrjAiH3rDMq4GVjODzETgbw+ez1M7h89iiXa+P0Ehg8rOXHEILdNYr1poZVi6q/7ZfGmDr70+lUZ38a3Wp02qJjjW41AjRG1uhWtTxIuomWF/HqvT8gv7jEfH/AyfUBId3Z3LfKmcyVaNpvESmpkulAZFSRMUXdQrNloqm10VBaaDldRiZwuDzHYk+nHMyQXUa8Wl269Yc5OoMRHEZr0V2DxTepBiENQt6pBt4pOhpyC381FWhWACHmv8WEoOnmCovdHuX6itqil/Oe0mWXivMSAcEe72yH8qv+2JvP/rwwruXwQN0K6XC9Q879Ky7WKC+3GNPtdLVGXJRIJzO0/R6M6sduUHelmi7lQGFklVLotpJMp6ruQgh3N9DTIYysuvgjXnxe/oSKBmhTKoGKy91zeGdt7p7J3Wu7kA0HUsuGpFmQlDZESYduBPgNKCfc/pZ3JFwAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Registration Schema LoginRadius CLI\"\n        title=\"Registration Schema LoginRadius CLI\"\n        src=\"/static/ed279d6255a3f75727dc0bb5c05069e0/e5715/registration_schema.png\"\n        srcset=\"/static/ed279d6255a3f75727dc0bb5c05069e0/a6d36/registration_schema.png 650w,\n/static/ed279d6255a3f75727dc0bb5c05069e0/e5715/registration_schema.png 768w,\n/static/ed279d6255a3f75727dc0bb5c05069e0/161ec/registration_schema.png 1840w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"loginradius-site-management\" style=\"position:relative;\"><a href=\"#loginradius-site-management\" aria-label=\"loginradius site management 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>LoginRadius Site Management</h3>\n<p>LoginRadius Dashboard provides a feature where you can create and manage multiple applications for your multiple products. </p>\n<p>With the help of LoginRadius CLI you can manage your sites via terminal using commands like <code>lr get site</code>, <code>lr set site</code>, <code>lr add site</code>, <code>lr delete site</code>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 136.46153846153845%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAbCAYAAAB836/YAAAACXBIWXMAABYlAAAWJQFJUiTwAAAE50lEQVRIx32VWXPaWBSEeYljC4SQhHYEArSx72AWY2PipcblZJZkqiZTlaf8/7/Q01csE0/NzMOpayjzqU/3uUe55Pt36FEErdtFIY5RjBMo/CyqGMXQ0hS18QSV4RAqP8v1xqGC+qFqAasOybLh75+QC799gzoYwl+vUVlcw57OYMyX0EcTqJ0Oqwu11UGp1UYpbaGUpCjFrIgPDmNWlJ2yX0Pldo9c8+ufaGy2aD88oH1/D2M4gjaZQx+MDoAM0oJCkEL1pSg+gJrsoBFCaTRZIQqeD3d9S4V/fEVwvUK4+wCXZ219A5Pqiu0utP6ICnsH0BkW/Q2rN1Fk+0WeebcCd7lFLibw/vNnzF8/InnYY/T6gjpbr80XsPqDzMf/hAWNcxVcj4I2bPnL7+hub1ElpLO7R+9+D280RiCAvX7W3glWbIZvYbV6Fog4C44HZ75CLvj1MzS2VSNQQBwGVOCPJf6oQH8yCEv5N1iVsGqQVd52GeiSCn/7gv7+EaOnZyxeXjDlGS3XSFZr9G53sLs9aGxZ+PQWRpAfZOmKylsO7PECufqnX9Dd3KB9t0PrZos+2+7QgunjE0Kq9pm2waTlo1fyj7AKYZVqVnnThj2cs+XXT4ivl0hvbpGsN5mq/t09Jg+P0DlvBeHRD7CsRaFKwLxqNi4yK2/YDHGKXO3lI8q9IaLVBs3ZHGZvAKXdJ4g/5E1Q/g/mEsZxkXlKZYshjqnwp1e4/SHC1Q1szl0xTKAmbajZbUjpXXhosXr0qyJUHWFOJUu3wFMqmzA7I3pI4HC3x/DxGVW23t1/gEOVskg0PIRxMv4Ek08w2zuXpBswWwMqfH7BgpCIIxMt6eV6Bb/bRziZwmK6efpTPMP8tzDLZbpudkqaASPpIed/eEIwnqIymiJd3qDF1stph8l2oAmFnLWz+YQVjrD8CWY6WV2pZRhRlwofntHf3mFEsEdVIefPH4xRqIowwgx4Mv8N7AgS6Yq6KukoN9tM+f4BE85dndetNh5zhBao8eZUuLKKnp+ZflDmnWGZKuMIY7p53cKVoqHcSJETOyyeXaPKljvrLXqbO1itLoyYK4sKZa92Nv4EO4DsbFQk3UReMzOgHiTIVQlMF0v0tjt4wzFa3I1uu4crh2GwbeHfj36dYfoJZiCvGrgsqtCrEUPZ7DAmpEHffK75xnQKh9vYbnLLZDAnS/HQ5qFFAROqBExiGFKpjEu5BK0SsuUVt/VsgSpnr0loOWhC5T3VRLpiYI+mC9AVFZ1alNQD7IowSdFxWVCguQ3knPmaaylGkx6GbLnJW1OOeFPaI3rZgsMS6mTTRYkPkEW7GczIlAnYCajaAXL2bAmX7wwBSyezTG06nsHjHIa84wlVRzzDzgAO1StM90JW8V5UoYT3eQUXkoJ3l3mUzCpyFndYxJGZcsv0+E4Rfs4Z0HRziwlTF7XhaM1oTUcMP+97i9XnQ20uCYPhmW4VOm3RzBpbHs0R8x/aHJ2YKmMqSnh2p/SVo2NUAlj0s2R5MPl3mQBRhl2Bzu8yIEunx2rZF8AFPbKhMNGi8IiJCr9Eift5Kfwpatn5zzYvpCIuLmVWAe/eSSipHl+jTz/Dm65hD+ZcX2yjO4HVHsNKh7CSARdEH2bYhdng/a5TcS2F4ccoexGVNqHbDehmwJYD2E6CvwCOLewZFJTetgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Site Management in LoginRadius CLI\"\n        title=\"Site Management in LoginRadius CLI\"\n        src=\"/static/fdec753179cfd0aaae5ff08af571768e/e5715/site_management.png\"\n        srcset=\"/static/fdec753179cfd0aaae5ff08af571768e/a6d36/site_management.png 650w,\n/static/fdec753179cfd0aaae5ff08af571768e/e5715/site_management.png 768w,\n/static/fdec753179cfd0aaae5ff08af571768e/07a9c/site_management.png 1440w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"contributing-to-loginradius-cli\" style=\"position:relative;\"><a href=\"#contributing-to-loginradius-cli\" aria-label=\"contributing to loginradius cli 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>Contributing to LoginRadius CLI</h3>\n<p>The <a href=\"https://github.com/LoginRadius/lr-cli/\">LoginRadius CLI</a> is opensourced in the <a href=\"https://github.com/LoginRadius\">LoginRadius Organization</a>  and you can contribute to it if you find any bugs or improvement by following the contributing guidelines. You can also checkout our <a href=\"https://www.loginradius.com/open-source/\">open source page</a> if you wish to contribute more in LoginRadius.</p>\n<h3 id=\"your-take\" style=\"position:relative;\"><a href=\"#your-take\" aria-label=\"your take 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>Your Take</h3>\n<p>With the help of LoginRadius CLI, you can setup the authentication for your Angular application in just 5 minutes. LoginRadius will take care of all the authentication-related stuff for your application so that you can focus on your application development.</p>\n<p>I hope you like this tutorial. Kindly provide feedback suggestions in the comment section below.</p>\n<p>Cheers!!!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n</style>","frontmatter":{"date":"April 14, 2021","updated_date":null,"title":"Implement Authentication in Angular 2+ application using LoginRadius CLI in 5 mins","tags":["Authentication","Angular","CLI","LoginRadius CLI"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/7c2ac2ca4ca6e495e226891293c79e92/14b42/angulat_demo_auth.jpg","srcSet":"/static/7c2ac2ca4ca6e495e226891293c79e92/f836f/angulat_demo_auth.jpg 200w,\n/static/7c2ac2ca4ca6e495e226891293c79e92/2244e/angulat_demo_auth.jpg 400w,\n/static/7c2ac2ca4ca6e495e226891293c79e92/14b42/angulat_demo_auth.jpg 800w,\n/static/7c2ac2ca4ca6e495e226891293c79e92/47498/angulat_demo_auth.jpg 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Mohammed Modi","github":"mohammed786","avatar":null}}}},{"node":{"fields":{"slug":"/engineering/three-ways-to-do-crud-operations-on-redis/"},"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>Redis's usage as both a temporary data store and even as a permanent data store is increasing today, as memory has started becoming much cheaper. Redis' quick memory-based CRUD operations allow database interactions to happen significantly faster than interactions with other databases that use drive-based storage. This blog is about three different methods to interact with your Redis data.</p>\n<p>This blog will require having access to a Redis instance. Guides can be found to set up a local Redis instance for Windows <a href=\"https://redislabs.com/blog/redis-on-windows-10/\">here</a> and for UNIX based machines like Mac or other Linux distros, it can be found <a href=\"https://redis.io/topics/quickstart\">here</a>. Alternatively, you can use a remote instance, but be aware that some of the commands in this blog may delete or modify the data.</p>\n<h2 id=\"redis-insight\" style=\"position:relative;\"><a href=\"#redis-insight\" aria-label=\"redis insight 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>Redis Insight</h2>\n<p>For users that do not like working with command-line interfaces, the first tool introduced in this blog is a GUI interface called RedisInsight. This can be found <a href=\"https://redislabs.com/redis-enterprise/redis-insight/\">here</a>. After filling in their download form and installing, running the application will start a server on the localhost, which you can access with a browser.</p>\n<p>After installing and running the application, you will add the connection information for your Redis instance. If running a local instance of Redis, the connection information in the image will typically suffice. If connecting to a remote instance, you might need to fill in some additional details for TLS, such as connection certificates.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 80.46153846153847%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAYAAAAWGF8bAAAACXBIWXMAAAsTAAALEwEAmpwYAAABhklEQVQ4y6VU226CQBTk/7+gj/2GPtrXGhIrAmpSLwgSE6NWRBFElst0zyIENKWYnmSynOXs7OwsHOnl9Q2K0sdHtwtZltHlY6/3icVi0QijgHHLDQP9vgJJlrsIggCO4+BwOAi4rivmWsP3EYYhTNOCNBioEJFlqEZ2lzdFUTsejyGpqoqIJVzZsSRljMHzPFHYBkmSiHW6rpPCgUhostiJxjRNa3kTqJZiOBzmR2ZxCu90Lo9A5OSlz715mlCpKGyz+E9C8jDmCoNzUCqMokgobLNB4TnFaDT63cN/KBwgSTNstg784FKS03dVXMxzHiq5wmKyepS2ah9umdbv9i4u4bUkJx8LkEfF8/V65Z7Htc3uCHOFdFzG4lrRPZKkklPNDTRfu+VLyLD73vNv8SRUNN3ozYg6spxQ0zRImqa3/md3+yPfMMYlAjZuiv0pw5aPjpcTznnHkTqdd6zXa5iWheVyyWE/wLZtWPzdZDrjrcrkbWuJr5mFCQeN07mJ1WrF26CCHy+V0P4EYqRsAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Connect\"\n        title=\"Connect\"\n        src=\"/static/e39b9b677a5c9b82b15bbc694fc376d2/e5715/connect.png\"\n        srcset=\"/static/e39b9b677a5c9b82b15bbc694fc376d2/a6d36/connect.png 650w,\n/static/e39b9b677a5c9b82b15bbc694fc376d2/e5715/connect.png 768w,\n/static/e39b9b677a5c9b82b15bbc694fc376d2/1d553/connect.png 1159w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>When connected to your Redis instance, the dashboard UI appears. Clicking the Browser sidebar tab will display all existing keys in your database.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 64%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAABg0lEQVQ4y62S3UrEMBCF8zii7l8VxBsR9EbfUPGq+7++i+C1i6i4iu5227TZpmmTHKdZlYKuuOLQj9DJ5EzOEHZ0dILD41Ps7R9gc7MGz9tFq+nBa+04Wi3vC41GE/V6w9Vt12uob1BtbQ9b21tgk/ENniYTBEGAMOJ4nYV4fpkh4jHmIYcQiy8kQiBJxOd/GIXgMUdE59lrwGEsQB9tSnCeQGYKYiGhCovCYCW5XlLNsVkooLSFVBpRQt2oIxep62ythTHmW7TWUCqvoJBKBRaTSLmpqehuFuGepyQqkVPrghr9HkOODNiUZpaRxTJBV0IZKi+Q5WZNrIPxWLgb5oUmK9bZzMhCWVTO8Pe83zCYc0iZkah1tsuoCq4rzF6mc2dZm6VdZ1kVfxcsyOrH3G4fnjCNBNJSpDKftQTdM6AZLtIM1+NHXI0neJjG9BYLLGSOlNYqZe4nGP452Nn5BXzfR6fbQ7vbR7vTg9/p0rqkPxihPxxhMLxEbzCE317m/RW8AWsht8xL0ZiyAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Browser\"\n        title=\"Browser\"\n        src=\"/static/e4e72b247e376fc38654a8e9ea97b8cc/e5715/browser.png\"\n        srcset=\"/static/e4e72b247e376fc38654a8e9ea97b8cc/a6d36/browser.png 650w,\n/static/e4e72b247e376fc38654a8e9ea97b8cc/e5715/browser.png 768w,\n/static/e4e72b247e376fc38654a8e9ea97b8cc/1df5b/browser.png 1999w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>From here, CRUD operations are relatively straightforward. Key-value pair creation can be done by using the ADD KEY button. This will prompt for the type of key-value pair to be added (Hash, String, JSON, etc.) and the data that will be stored with the key.</p>\n<p>If a specific key is required to be queried, fill in the field next to the blue filter icon with search criteria, then click the icon. It will prompt the type of data stored with the key, and the results will be displayed.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 64%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAABeklEQVQ4y62S20rDQBCG93GkNdFGoXgjQr3RN1S8Ss/1XQSvLYKlqbRpmmzOm9PvZGMlF6204pKP3cwO//wzLOt07nBze4/21TUaDQWadonWuQatdSFptbSdqOqZzFNUBeoJ5SptNE+bYMb0DQvDgGVZsG2O1drG53INh7vY0L/vBzvxPP/nbDs2uMvhOBxsZXHkBUAf/CAC5x6iWMizSAukOfaSZBX1GFvbPkRWIBIZ1o4L2wvA/VBWLooCeZ7vJMsyCJHUEAgjAeaSQHmZkc257eGDh3DIXUKlUyp0ODl1lIOZNLOYWiwD25UkKeIkP5JCwrjrS4dJWrks24yphTKpnOHhfDu0NhxRFJNoQYKVy7rgscJsaW5ky6W77RIi/btgSq1KEZrb+2wB0/ERliK1+RwlKJ8BzTAIY7xO53iZGpiZLr3FFEGUIKS9Thn7DYZ/Xuzh8Qm6rqPXH6DbH6LbG0Dv9WmvGI4mGI4nGI2fMRiNoXeruL6HL5SRt9nF32tXAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"Filter\"\n        title=\"Filter\"\n        src=\"/static/53a06909b443c049fd05525a7800f50e/e5715/filter.png\"\n        srcset=\"/static/53a06909b443c049fd05525a7800f50e/a6d36/filter.png 650w,\n/static/53a06909b443c049fd05525a7800f50e/e5715/filter.png 768w,\n/static/53a06909b443c049fd05525a7800f50e/1df5b/filter.png 1999w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Finally, keys can be deleted by clicking the trash can icon on the right side.</p>\n<h2 id=\"redis-cli\" style=\"position:relative;\"><a href=\"#redis-cli\" aria-label=\"redis cli 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>Redis CLI</h2>\n<p>The Redis command-line interface is a more common approach for developers to interact with data from a Redis store. If you followed the steps at the beginning of the blog, the CLI should already be installed. To do a ping test to the server, type the following command in the terminal:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">chris@LR-ENG-17:~$ redis-cli -h localhost -p 6379 ping</span>\n<span class=\"grvsc-line\">PONG</span></code></pre>\n<p>And to connect, run the previous command without pinging:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">chris@LR-ENG-17:~$ redis-cli -h localhost -p 6379</span>\n<span class=\"grvsc-line\">localhost:6379&gt;</span></code></pre>\n<p>The basic command to get a key-value pair is to call get with the key:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">localhost:6379&gt; get key:1</span>\n<span class=\"grvsc-line\">&quot;value1&quot;</span></code></pre>\n<p>Setting a value can be done with the set command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">localhost:6379&gt; set key:1 value1new</span>\n<span class=\"grvsc-line\">OK</span>\n<span class=\"grvsc-line\">localhost:6379&gt; get key:1</span>\n<span class=\"grvsc-line\">&quot;value1new&quot;</span></code></pre>\n<p>Creating a value can also be done in the same way:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">localhost:6379&gt; get key:3</span>\n<span class=\"grvsc-line\">(nil)</span>\n<span class=\"grvsc-line\">localhost:6379&gt; set key:3 value3new</span>\n<span class=\"grvsc-line\">OK</span>\n<span class=\"grvsc-line\">localhost:6379&gt; get key:3</span>\n<span class=\"grvsc-line\">&quot;value3new&quot;</span></code></pre>\n<p>And deletion can be done with the del command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">localhost:6379&gt; del key:3</span>\n<span class=\"grvsc-line\">(integer) 1</span>\n<span class=\"grvsc-line\">localhost:6379&gt; get key:3</span>\n<span class=\"grvsc-line\">(nil)</span>\n<span class=\"grvsc-line\">localhost:6379&gt;</span></code></pre>\n<p>This is only the simple basics of the Redis CLI. You can do more advanced operations through the CLI, such as the flushall command, which wipes your database. It’s a powerful tool, so be careful when experimenting with it. An extensive list of commands can be found <a href=\"https://redis.io/commands\">here</a>.</p>\n<h2 id=\"with-your-chosen-programming-language\" style=\"position:relative;\"><a href=\"#with-your-chosen-programming-language\" aria-label=\"with your chosen programming language 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>With Your Chosen Programming Language</h2>\n<p>With Redis’ widespread usage, almost all major industry programming languages have either community or official supported releases of libraries that can be used to interact with your database. In this section, I will be using Node.JS, and one of the support Redis libraries called <a href=\"https://github.com/NodeRedis/node-redis\">node-redis</a>.</p>\n<p>Initialization of the package in the code can be done by calling the following command after initializing Node in your directory:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">npm install redis</span></code></pre>\n<p>When the process is finished, the <code>redis</code> module should be imported within your code, where you can set up the Redis connection and any options that need to be included:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">redis</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">require</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;redis&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">redisOption</span><span class=\"mtk1\"> = {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">host:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;127.0.0.1&quot;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">port:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;6379&quot;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">client</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">redis</span><span class=\"mtk1\">.</span><span class=\"mtk11\">createClient</span><span class=\"mtk1\">()</span></span></code></pre>\n<p>For an extensive list of options supported by the library for connection, check this <a href=\"https://github.com/NodeRedis/node-redis#API\">link</a>.</p>\n<p>After connecting, calling the <code>on</code> method on the client will allow the connection to open and run commands.</p>\n<p>The commands used by the library are a 1 to 1 mapping of the commands used by the Redis CLI, so they follow the same method calls. To update or create an entry in Redis, the most basic method is to use the set command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">set</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;value3new&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>Getting a value can be done with the get method:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">get</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>Deleting a value can be done with the del method:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">del</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>The methods used by the client also support callbacks. For example, if the operations should be console logged, we can include a callback to <code>redis.print</code> after each method:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">set</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk8\">&quot;value3new&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">redis</span><span class=\"mtk1\">.</span><span class=\"mtk12\">print</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">get</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">redis</span><span class=\"mtk1\">.</span><span class=\"mtk12\">print</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">client</span><span class=\"mtk1\">.</span><span class=\"mtk11\">del</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;key:3&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">redis</span><span class=\"mtk1\">.</span><span class=\"mtk12\">print</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>The output of this in the console would be:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"console\" data-index=\"12\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Reply: OK</span>\n<span class=\"grvsc-line\">Reply: value3new</span>\n<span class=\"grvsc-line\">Reply: 1</span></code></pre>\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>This blog has only touched the surface of the different operations Redis can do. There are many more resources online that can help you go further into your understanding of Redis. Whether using Redis as a temporary store, like a cache, or using it as a primary, permanent store, the operations' speed is something to be acknowledged and considered when building your next big app.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n</style>","frontmatter":{"date":"October 21, 2020","updated_date":null,"title":"Three Ways to do CRUD Operations On Redis","tags":["Redis","NodeJs","CLI","GUI"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/4eda1ce5a0f541d97fdf27cd88bf2a49/ee604/index.png","srcSet":"/static/4eda1ce5a0f541d97fdf27cd88bf2a49/69585/index.png 200w,\n/static/4eda1ce5a0f541d97fdf27cd88bf2a49/497c6/index.png 400w,\n/static/4eda1ce5a0f541d97fdf27cd88bf2a49/ee604/index.png 800w,\n/static/4eda1ce5a0f541d97fdf27cd88bf2a49/f3583/index.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Chris Yee","github":null,"avatar":null}}}},{"node":{"fields":{"slug":"/engineering/build-a-cli-tool-using-deno/"},"html":"<h3 id=\"what-is-deno\" style=\"position:relative;\"><a href=\"#what-is-deno\" aria-label=\"what is deno 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>What is Deno?</h3>\n<p>Deno is a JavaScript/TypeScript runtime with secure defaults and great developer experience. It's built on V8, Rust, and Tokio.\nI suggest you watch these talks by Ryan: He talks about his mistakes with Nodejs <a href=\"https://www.youtube.com/watch?v=M3BM9TB-8yA&#x26;vl=en\">here</a> and a more in-depth look into deno <a href=\"https://www.youtube.com/watch?v=z6JRlx5NC9E\">here</a></p>\n<h5 id=\"features\" style=\"position:relative;\"><a href=\"#features\" aria-label=\"features 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>Features</h5>\n<ul>\n<li>Secure by default. No file, network, or environment access (unless explicitly enabled).</li>\n<li>Supports TypeScript out of the box.</li>\n<li>Ships a single executable (deno).</li>\n<li>Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).</li>\n<li>Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno.\nScripts can be bundled into a single JavaScript file.</li>\n</ul>\n<h3 id=\"lets-build-something\" style=\"position:relative;\"><a href=\"#lets-build-something\" aria-label=\"lets build something 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>Let's Build Something!!!</h3>\n<p>In this article, we're going to build a simple cli tool to demonstrate some of the features of <a href=\"https://deno.land/\">deno</a>. Our cli will be interacting with a <strong>COVID</strong> API to fetch live data.</p>\n<blockquote>\n<p>Requirement: make sure you have deno installed. If you don't, refer to this <a href=\"/hello-world-deno/\">link</a>. It's pretty straightforward.</p>\n</blockquote>\n<p>Deno has the entry file <code>mod.ts</code> so we will follow the same in this article if you are following this article along with the coding you can create a folder named <code>covid-cli</code>, inside that folder you can create a file called <code>mod.ts</code> and copy the below code there.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">args</span><span class=\"mtk1\"> } = </span><span class=\"mtk12\">Deno</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">parse</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;https://deno.land/std/flags/mod.ts&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">dir</span><span class=\"mtk1\">(</span><span class=\"mtk11\">parse</span><span class=\"mtk1\">(</span><span class=\"mtk12\">args</span><span class=\"mtk1\">));</span></span></code></pre>\n<p>Here the <code>parse(args, options = {});</code> contains two parameters where args is an <code>Array</code> and <code>options</code> is an object, let try to run the above code using this cmd.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">deno run mod.ts arg1 -f hello --flag World --booleanFlag</span></code></pre>\n<p>After running the above code you will see the <strong>output</strong> as</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">{ _: [ &quot;arg1&quot; ], f: &quot;hello&quot;, flag: &quot;World&quot;, booleanFlag: true }</span></code></pre>\n<blockquote>\n<p>The first property in the object is always an array containing all arguments that did not have an option associated with them(i.e it doesn't match -f or --flag). If you do not pass a corresponding value to a flag, it defaults to true.</p>\n</blockquote>\n<p>I will be using the <a href=\"https://documenter.getpostman.com/view/10808728/SzS8rjbc?version=latest\">this</a> postman doc for all the COVID related API and we will perform the below to action through our CLI.</p>\n<ol>\n<li>A summary of new and total cases globally updated daily.</li>\n<li>A summary of new and total cases per country updated daily.</li>\n</ol>\n<p>Let's write out the function for our first command, so our <code>mod.ts</code> file will look like this.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">args</span><span class=\"mtk1\"> } = </span><span class=\"mtk12\">Deno</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">parse</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;https://deno.land/std/flags/mod.ts&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// flags:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -h, --help: display help message</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -g, --global: display global stats</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -c, --country: get data of mentioned country</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;https://api.covid19api.com/&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">parsedArgs</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">parse</span><span class=\"mtk1\">(</span><span class=\"mtk12\">args</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">async</span><span class=\"mtk1\"> </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getGlobalStats</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk11\">fetch</span><span class=\"mtk1\">(</span><span class=\"mtk8\">`</span><span class=\"mtk4\">${</span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk4\">}</span><span class=\"mtk8\">summary`</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">data</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\">.</span><span class=\"mtk11\">json</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Global&quot;</span><span class=\"mtk1\">])</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Here, we have an async function that returns the data from our API call. We're making a fetch request (yes, deno has browser functionality in-built) to the API endpoint to get the global stat of covid19.</p>\n<p>The function for the second command looks very similar, just we need to filter our data only for a particular country which is provided.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">async</span><span class=\"mtk1\"> </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getCountryStats</span><span class=\"mtk1\">(</span><span class=\"mtk12\">country</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">country</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk11\">fetch</span><span class=\"mtk1\">(</span><span class=\"mtk8\">`</span><span class=\"mtk4\">${</span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk4\">}</span><span class=\"mtk8\">summary`</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">data</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\">.</span><span class=\"mtk11\">json</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">index</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Countries&quot;</span><span class=\"mtk1\">].</span><span class=\"mtk11\">findIndex</span><span class=\"mtk1\">((</span><span class=\"mtk12\">c</span><span class=\"mtk1\">: </span><span class=\"mtk10\">any</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">c</span><span class=\"mtk1\">.</span><span class=\"mtk12\">Country</span><span class=\"mtk1\">.</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">() === </span><span class=\"mtk12\">country</span><span class=\"mtk1\">.</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">())</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">index</span><span class=\"mtk1\"> !== -</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Countries&quot;</span><span class=\"mtk1\">][</span><span class=\"mtk12\">index</span><span class=\"mtk1\">])</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Country Not Found&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Country Name is needed&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>We will now write our <code>main()</code> function. We have a switch statement to check the first flag that was passed and calls the appropriate function. The default case simply displays a welcome message. Let add the below code in our <code>mod.ts</code> file</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">async function main() {</span>\n<span class=\"grvsc-line\">  switch (Object.keys(parsedArgs)[1]) {</span>\n<span class=\"grvsc-line\">    case &quot;help&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;h&quot;:</span>\n<span class=\"grvsc-line\">      console.log(displayHelpMsg());</span>\n<span class=\"grvsc-line\">      break;</span>\n<span class=\"grvsc-line\">    case &quot;global&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;g&quot;:</span>\n<span class=\"grvsc-line\">      await getGlobalStats();</span>\n<span class=\"grvsc-line\">      break;</span>\n<span class=\"grvsc-line\">    case &quot;country&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;c&quot;:</span>\n<span class=\"grvsc-line\">       let country = parsedArgs.c || parsedArgs.country || &quot;&quot;</span>\n<span class=\"grvsc-line\">       await getCountryStats(country)</span>\n<span class=\"grvsc-line\">       break;</span>\n<span class=\"grvsc-line\">    default:</span>\n<span class=\"grvsc-line\">       console.log(displayHelpMsg());</span>\n<span class=\"grvsc-line\">  }</span>\n<span class=\"grvsc-line\">}</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">main()</span></code></pre>\n<p>And our <code>displayHelpMsg()</code> will look something like this</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">function displayHelpMsg() {</span>\n<span class=\"grvsc-line\">  return &quot;flags:\\n-h, --help: display help message\\n-g, --global: display global stats\\n-c, --country: get data of mentioned country &quot;;</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n<h3 id=\"testing-time\" style=\"position:relative;\"><a href=\"#testing-time\" aria-label=\"testing time 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>Testing Time!!!</h3>\n<p>To test our program, we're going to run $ deno run <code>--allow-net mod.ts -g</code>. We should get the following result:</p>\n<ul>\n<li>For Global Records</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 529px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 30.434782608695656%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAwklEQVQY052Q20rDQBRFTy6VzGQqnWaoNFMwSUMvijc0sdj8/28tD/0AIT6shwObxd5HjLHEGAlV4H65ZLN50LslhJqmadntIlVVYY1BREjT9E/E+xVd11Fvt7RNp6LAfi8ceiHP5CaZhfeey+Wb15c3np9OfLw3NI939CqMdaahZK5wxfX6wziMnE9nbZkyfInOz2+BJJnZcL32TNOkkkEZOR56bZwwfGY494/JRp9dFAVl6bDWUFrHYpHjveDK+cJf0ASG38Zw4SUAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"global-data\"\n        title=\"global-data\"\n        src=\"/static/f5e1dc8db77f90036f3afb3632db5c4a/67d6a/global-data.png\"\n        srcset=\"/static/f5e1dc8db77f90036f3afb3632db5c4a/67d6a/global-data.png 529w\"\n        sizes=\"(max-width: 529px) 100vw, 529px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ul>\n<li>For Country Wise Record</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 540px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 43.333333333333336%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA9klEQVQoz6WR3U7CQBBGp102DaCttqVAqcUuS/hxKxA0iPj+r3VcondeUS/OzUxy5psZmc0qxuMxWZpRZBOa2jCva+p6jjGGNH1kNCqwdkkSxyil0Fr/IQxD8jxHrsKqrBjeD4gqYVCGiEgnYj9Q3EuLsXOatuLBRKipbwaqkzBJEuTrcsEuDPbopZuGZRPwVCmCoKPwcDiw3+1Z2TWvbuHvN6R5Fka56ib8PJ85n0441/pH9NluBBX+Y+WTl3143o7vuLXzKTW7VhHfBd2E69WGYpqRbQcULiaxEWUrTLaKqBTC/o1C3dM/hZ5H/3J9iBICfXvCb90VyQaeJu7lAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"country-data\"\n        title=\"country-data\"\n        src=\"/static/127ea015735159e5a971037b03086626/07484/country-data.png\"\n        srcset=\"/static/127ea015735159e5a971037b03086626/07484/country-data.png 540w\"\n        sizes=\"(max-width: 540px) 100vw, 540px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ul>\n<li>For Help</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 539px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 19.109461966604822%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAmElEQVQY04WQwQ6DIBBE6cWCAtooknLB4NGUiOj/f9p0MfVqDy+zmcPszrJlWTD0PbTWUErBWgs7jujJK3PxBOdgjBGPn97gvUfBDAbOOUx+gjE0vx35E+YQwPnzf9BFuSTnAzklhDBjzzvSuiKlDfETsZEfY0TXdeeiF+ltYFVVaBoJJSXquj4p9YUQJ6Xy9Y62baFJ7wK/88xcqip0NT8AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"help\"\n        title=\"help\"\n        src=\"/static/e4adbfd05826f98cf308261ca2215093/10f9a/help.png\"\n        srcset=\"/static/e4adbfd05826f98cf308261ca2215093/10f9a/help.png 539w\"\n        sizes=\"(max-width: 539px) 100vw, 539px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>That's all there is for our cli tool. If you'd like to see the full code, the repository is linked <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/Deno/covid-cli\">here</a>. In conclusion, Deno is a very exciting project especially because you get all the benefits of typescript out of the box without the need to compile your files to js. </p>\n<p>You can build a lot with it, ranging from cli Programs to HTTP servers. Do have a look at one of my <a href=\"/a-webapp-in-deno/\">blog</a> where I have built a basic calculator app using the <a href=\"https://deno.land/x/abc@v1.3.3\">abc</a> module.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"date":"June 08, 2020","updated_date":null,"title":"Build A Simple CLI Tool using Deno","tags":["Deno","CLI","Programming"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7857142857142858,"src":"/static/313a3b2de31b5d15db618e72b377a867/ee604/cli-tool.png","srcSet":"/static/313a3b2de31b5d15db618e72b377a867/69585/cli-tool.png 200w,\n/static/313a3b2de31b5d15db618e72b377a867/497c6/cli-tool.png 400w,\n/static/313a3b2de31b5d15db618e72b377a867/ee604/cli-tool.png 800w,\n/static/313a3b2de31b5d15db618e72b377a867/5493e/cli-tool.png 860w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Mohammed Modi","github":"mohammed786","avatar":null}}}}]}},"pageContext":{"tag":"CLI"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}