{"id":13893,"date":"2023-10-10T08:06:35","date_gmt":"2023-10-10T08:06:35","guid":{"rendered":"https:\/\/positiwise.com\/blog\/?p=13893"},"modified":"2023-12-27T08:53:55","modified_gmt":"2023-12-27T08:53:55","slug":"asp-net-mvc-google-authentication-guide","status":"publish","type":"post","link":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide","title":{"rendered":"ASP.NET MVC Google Authentication: A Complete Integration\u00a0Guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong class=\"pw-highlight-text-color\"><em>Quick Overview:<\/em><\/strong><br>Verifying the user is now a necessity to maintain data security and allow only authorized users on the platform. But, as cyber-attacks are increasing, it&#8217;s important to take some additional measures, such as two-factor authentication using the Google authenticator app. You can use Google Authenticator with software based on any software. But, in this blog, you will find the details about two-factor authentication using Google authenticator in ASP.NET MVC application.<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#A_Run-Through_NET_Core_vs_Nodejs\" >A Run-Through: .NET Core vs Node.js<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#NET_Core\" >.NET Core<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Pros_of_using_NET_Core\" >Pros of using .NET Core<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Nodejs\" >Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#A_Deep_Dive_into_NET_Core_vs_Nodejs\" >A Deep Dive into .NET Core vs. Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Processing_Approach_and_Performance\" >Processing Approach and Performance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Security\" >Security<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Scalability\" >Scalability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Platform_Adaptability\" >Platform Adaptability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Support_from_Community\" >Support from Community<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Comparison_Table_between_NET_Core_and_Nodejs\" >Comparison Table between .NET Core and Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Wrapping_Up_on_NET_Core_vs_Nodejs\" >Wrapping Up on .NET Core vs Node.js<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\">Integrating Google Authenticator into an ASP.NET MVC Project<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the app development domain, data security is taken as a priority while configuring the security mechanisms. Authentication is considered the prime pillar, which is a must for every software to support retaining data integrity and preventing unauthorized access. More specifically, with the advancements, two-factor authentication using the Google authenticator app is preferred now. We have curated a complete tutorial to help you understand how two-factor authentication using Google authenticator in ASP.NET MVC works. A step-by-step explanation provided further will clear all your doubts. So, let\u2019s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Google Authenticator?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Google Authenticator is a mobile application that aids in strengthening security by supporting two-factor authentication. The app provides a unique code that users need to enter before accessing the platform resources and data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To thoroughly understand, let&#8217;s break it down into two layers. Suppose the first layer is your account credentials, which are username and password. The second layer is the unique code provided by the Google Authenticator app. First, you need to input the credentials, and if the app verifies them as correct, you pass the first layer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Further, the platform will demand a code, which the Google authenticator app will provide. When you input the correct code on the platform, you will pass the second security layer and get access to authorized resources. Thus, two-factor authentication will come into effect by using Google Authenticator.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Does Two-Factor Authentication Work?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The working of Google authenticator is quite streamlined. It works per the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the platform or web app where you want to log in.<\/li>\n\n\n\n<li>Input your correct credentials for enabling the web app to display a QR code.<\/li>\n\n\n\n<li>Now, using the Google authenticator, scan the QR code.<\/li>\n\n\n\n<li>After the scan, the authenticator will generate a code.<\/li>\n\n\n\n<li>Input the code on the web app.<\/li>\n\n\n\n<li>After verifying the code, the web app will grant access.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You will see the same functioning in the provided tutorial for better clarification.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Need for Two-Factor Using ASP.NET MVC Application<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two-factor authentication is the prime need in this digital landscape. It supports maintaining the overall security of the application and retaining data integrity and confidentiality. In addition, it benefits with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Double checking of the user\u2019s identity.<\/li>\n\n\n\n<li>Prevention of unauthorized access.<\/li>\n\n\n\n<li>Extended security for two-factor authentication.<\/li>\n\n\n\n<li>Minimal possibility of account breach.<\/li>\n\n\n\n<li>User convenience and satisfaction.<\/li>\n\n\n\n<li>Saving cost, as Google authenticator is a free-to-download and use application<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Implement Two-Factor Authentication Using Google Authenticator in ASP.NET MVC<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To solidify the security of your ASP.NET MVC application, you will require Visual Studio IDE. It will help you configure two-factor authentication using the Google authenticator app. Before you start with the implementation, ensure that Visual Studio version 2019 or above is installed. However, if you are utilizing an older version, integrate the NuGet package installer with it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, you will need a mobile phone to download, install, and access the Google Authenticator app. You can use any Android and iOS mobile compatible and supporting the application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the Visual Studio IDE installation, follow the below steps as defined: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1:<\/strong> Open the Visual Studio IDE to create a new ASP.NET MVC project. Once the application gets opened, choose the <strong><em>ASP.NET Web application (.NET Framework)<\/em><\/strong> template and click on <strong><em>Next<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1259\" height=\"841\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-web-application-framework.png\" alt=\"ASP.NET Web Application Framework\" class=\"wp-image-13906\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-web-application-framework.png 1259w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-web-application-framework-300x200.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-web-application-framework-1024x684.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-web-application-framework-768x513.png 768w\" sizes=\"auto, (max-width: 1259px) 100vw, 1259px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 2:<\/strong> Fill out the information of the ASP.NET web application project. You need to <strong><em>define a project name<\/em><\/strong>, solution name, framework version, and location to save the project files. After finalizing all the details, click on <strong><em>Create<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1257\" height=\"841\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-demo-project-name.png\" alt=\"GoogleAuthenticatorDemo as Project Name\" class=\"wp-image-13911\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-demo-project-name.png 1257w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-demo-project-name-300x201.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-demo-project-name-1024x685.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-demo-project-name-768x514.png 768w\" sizes=\"auto, (max-width: 1257px) 100vw, 1257px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 3:<\/strong> Before the final creation of the project, Visual Studio will ask you to define the type of web application. Here, you\u2019ll need to choose <strong><em>MVC (Model-View-Controller)<\/em><\/strong> from the provided options. Again, click on <strong><em>Create<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1286\" height=\"895\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/create-new-asp-net-web-application.png\" alt=\"Create New ASP.NET Web Application\" class=\"wp-image-13907\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/create-new-asp-net-web-application.png 1286w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/create-new-asp-net-web-application-300x209.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/create-new-asp-net-web-application-1024x713.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/create-new-asp-net-web-application-768x534.png 768w\" sizes=\"auto, (max-width: 1286px) 100vw, 1286px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 4:<\/strong> Now, go to the solutions explorer, and by using the right click on the project&#8217;s name, open the menu. From the numerous options displayed, choose to manage NuGet packages. It will open the <strong><em>NuGet package manager<\/em><\/strong>. <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Further, using the search field, find <strong><em>Google.Authenticator package<\/em><\/strong>. Once it gets displayed, <strong><em>Select and Install<\/em><\/strong> it for your ASP.NET web app project.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1423\" height=\"873\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-asp-net-mvc.png\" alt=\"Google Authenticator ASP.NET MVC\" class=\"wp-image-13910\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-asp-net-mvc.png 1423w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-asp-net-mvc-300x184.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-asp-net-mvc-1024x628.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-asp-net-mvc-768x471.png 768w\" sizes=\"auto, (max-width: 1423px) 100vw, 1423px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 5:<\/strong> After successful package installation, access the <strong><em>Model Folder<\/em><\/strong>. Under it, add a new class with the name &#8220;<strong><em>LoginModel.cs<\/em><\/strong>&#8220;.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The primary purpose of adding this class is to store the credentials that we are going to use to log in to the application. The code snippet is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\n\nnamespace GoogleAuthenticatorDemo.Models\n{\n    public class LoginModel\n    {\n        public string UserName { get; set; }\n\n        public string Password { get; set; }\n    }\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 6:<\/strong> In this step, you have to add the Google authentication private key. <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">To do so, open and access the <strong><em>Web.Config<\/em><\/strong> file. And funder the &lt;appSettings&gt;, define the following code block.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;appSettings&gt;\n    &lt;add key=\"webpages:Version\" value=\"3.0.0.0\" \/&gt;\n    &lt;add key=\"webpages:Enabled\" value=\"false\" \/&gt;\n    &lt;add key=\"ClientValidationEnabled\" value=\"true\" \/&gt;\n    &lt;add key=\"UnobtrusiveJavaScriptEnabled\" value=\"true\" \/&gt;\n\n\t&lt;add key=\"GoogleAuthKey\" value=\"P0W48S53\" \/&gt;\n&lt;\/appSettings&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The value defined in this code block can be changed to any string per your requirements. From a professional&#8217;s perspective, using a character combination tool for creating a strong string is always preferred. The reason behind using a tool is that this value is used as a private key by the Google authenticator app.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 7:<\/strong> We need an action button to perform the login functionality. To configure the <strong><em>Login action<\/em>\u00a0<\/strong>method, we will use the <strong><em>HomeController<\/em><\/strong> with the following code.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public ActionResult Login()\n{\n    Session&#91;\"UserName\"] = null;\n    Session&#91;\"IsValidTwoFactorAuthentication\"] = null;\n    return View();\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group border rounded bg-light has-global-padding is-layout-constrained wp-container-core-group-is-layout-71df2e02 wp-block-group-is-layout-constrained\" style=\"padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)\">\n<p class=\"has-text-align-center fs-2 text-blue lh-sm has-contrast-color has-text-color wp-block-paragraph\"><strong>Let&#8217;s Design the Perfect ASP.NET Application for Your Enterprise Business<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center mt-2 wp-block-paragraph\">Bring your unique software &amp; web application vision to a team of ASP.NET experts for Enterprise business. Our dedicated .NET developers design and build custom .NET app solutions for your needs.<\/p>\n\n\n\n<div class=\"wp-block-buttons mt-3 is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-20959078 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-base-color has-text-color has-background wp-element-button\" href=\"https:\/\/positiwise.com\/hire-asp-net-developers\" style=\"border-radius:100px;background-color:#ed7923;padding-top:10px;padding-right:30px;padding-bottom:10px;padding-left:30px\"><strong>Hire .NET Developers<\/strong><\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 8:<\/strong> We need a view for this method after creating the <strong><em>Login action<\/em><\/strong>. To implement it, use the right click on the action method and choose the <strong><em>Add View<\/em><\/strong> option. It will open a new window for configuring the additional details.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In the provided details, input the view name as Login, the template as Empty (without model), and check the use of a layout box. Lastly, click on the Add button. As a result, you will see a new name, &#8220;<strong><em>Login.cshtml<\/em><\/strong>&#8221; under the <strong><em>View -&gt; Home.<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"405\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/empty-without-model-asp-net-mvc.png\" alt=\"Empty Without Model ASP.NET MVC\" class=\"wp-image-13908\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/empty-without-model-asp-net-mvc.png 727w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/empty-without-model-asp-net-mvc-300x167.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 9:<\/strong> Open the <strong><em>Login.cshtml<\/em><\/strong> file and the below code to it. It defines the layout of the login page and the form shown to end-users.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>@model GoogleAuthenticatorDemo.Models.LoginModel\n@{\n    ViewBag.Title = \"Login\";\n}\n\n&lt;center&gt;\n    &lt;h2&gt;Login Page&lt;\/h2&gt;\n    @if (ViewBag.Status == null || !ViewBag.Status)\n    {\n        &lt;div&gt;@ViewBag.Message&lt;\/div&gt;\n        &lt;div&gt;\n            @using (Html.BeginForm())\n            {\n                &lt;div class=\"form-group\"&gt;\n                    &lt;label for=\"UserName\"&gt;UserName : &lt;\/label&gt;\n                    @Html.TextBoxFor(a =&gt; a.UserName, new { @class = \"form-control\" })\n                &lt;\/div&gt;\n                &lt;div class=\"form-group\"&gt;\n                    &lt;label for=\"Password\"&gt;Password : &lt;\/label&gt;\n                    @Html.TextBoxFor(a =&gt; a.Password, new { @class = \"form-control\", type = \"password\" })\n                &lt;\/div&gt;\n                &lt;input type=\"submit\" value=\"Login\" class=\"btn btn-default\" \/&gt;\n            }\n        &lt;\/div&gt;\n    }\n    else\n    {\n\n        &lt;div&gt;@ViewBag.Message&lt;\/div&gt;\n        &lt;div&gt;\n            &lt;img src=\"@ViewBag.BarcodeImageUrl\" width=\"300\" height=\"300\" \/&gt;\n\n        &lt;\/div&gt;\n        &lt;div&gt;\n            Manual Setup Code : @ViewBag.SetupCode\n        &lt;\/div&gt;\n        &lt;div&gt;\n            @using (Html.BeginForm(\"TwoFactorAuthenticate\", \"Home\", FormMethod.Post))\n            {\n                &lt;input type=\"text\" name=\"CodeDigit\" \/&gt;\n                &lt;input type=\"submit\" class=\"btn btn-success\" \/&gt;\n            }\n        &lt;\/div&gt;\n    }\n&lt;\/center&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 10:<\/strong> Now, in the <strong><em>Login Action Method<\/em><\/strong>, you need a <strong><em>Post<\/em><\/strong> type in the controller. To build it, add the below code to your project. We are using the static username and password for this tutorial, so the credentials are also defined in this piece of code. However, if you want to use dynamic credentials, you should connect the database and modify the code accordingly. <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, this code block also contains the two-factor authentication setup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;HttpPost]\npublic ActionResult Login(LoginModel login)\n{\n  bool status = false;\n\n  if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool) Session&#91;\"IsValidTwoFactorAuthentication\"])\n  {\n      string googleAuthKey = WebConfigurationManager.AppSettings&#91;\"GoogleAuthKey\"];\n      string UserUniqueKey = (login.UserName + googleAuthKey);\n\n      \/\/Take UserName And Password As Static - Admin As User And 456789 As Password\n      if (login.UserName == \"Admin\" &amp;&amp; login.Password == \"456789\")\n      {\n         Session&#91;\"UserName\"] = login.UserName;\n\n         \/\/Two Factor Authentication Setup\n         TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator();\n         var setupInfo = TwoFacAuth.GenerateSetupCode(\"UdayDodiyaAuthDemo.com\", login.UserName, ConvertSecretToBytes(UserUniqueKey, false), 300);\n         Session&#91;\"UserUniqueKey\"] = UserUniqueKey;\n         ViewBag.BarcodeImageUrl = setupInfo.QrCodeSetupImageUrl;\n         ViewBag.SetupCode = setupInfo.ManualEntryKey;\n         status = true;\n      }\n  }\n  else\n  {\n    return RedirectToAction(\"Index\");\n  }\n  ViewBag.Status = status;\n  return View();\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 11:<\/strong> Again, in the controller, develop a function of <em><strong>ConvertSecretToBytes<\/strong>.<\/em><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>private static byte&#91;] ConvertSecretToBytes(string secret, bool secretIsBase32) =&gt;\n           secretIsBase32 ? Base32Encoding.ToBytes(secret) : Encoding.UTF8.GetBytes(secret);<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 12:<\/strong> Build a <strong><em>TwoFactorAuthenticate<\/em><\/strong> action method for your controller.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public ActionResult TwoFactorAuthenticate()\n{\n     var token = Request&#91;\"CodeDigit\"];\n     TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator();\n     string UserUniqueKey = Session&#91;\"UserUniqueKey\"].ToString();\n     bool isValid = TwoFacAuth.ValidateTwoFactorPIN(UserUniqueKey, token, false);\n     if (isValid)\n     {\n         HttpCookie TwoFCookie = new HttpCookie(\"TwoFCookie\");\n         string UserCode =Convert.ToBase64String(MachineKey.Protect(Encoding.UTF8.GetBytes(UserUniqueKey)));\n\n         Session&#91;\"IsValidTwoFactorAuthentication\"] = true;\n         return RedirectToAction(\"Index\");\n      }\n\n      ViewBag.Message = \"Google Two Factor PIN is expired or wrong\";\n      return RedirectToAction(\"Login\");\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 13:<\/strong> Likewise, regarding login functionality, we also need our application to securely logout the user. To implement it, you should <strong><em>build a Logoff Action method<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public ActionResult Logoff()\n{\n     Session&#91;\"UserName\"] = null;\n     Session&#91;\"IsValidTwoFactorAuthentication\"] = null;\n     return RedirectToAction(\"Login\");\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 14:<\/strong> For projects with authentication functionality, it\u2019s essential to build a logic for managing <strong><em>unauthorized login<\/em><\/strong>. For this ASP.NET web app, you should add the following code to all the action methods.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>public ActionResult Index()\n{\n    if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n    {\n        return RedirectToAction(\"Login\");\n    }\n    return View();\n}\n\npublic ActionResult About()\n{\n     if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n     {\n         return RedirectToAction(\"Login\");\n     }\n\n     ViewBag.Message = \"Your application description page.\";\n     return View();\n}\n\npublic ActionResult Contact()\n{\n     if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n     {\n         return RedirectToAction(\"Login\");\n     }\n\n     ViewBag.Message = \"Your contact page.\";\n     return View();\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 15:<\/strong> After adding all the code to the specific files mentioned above, your <strong><em>Final HomeController.cs File<\/em><\/strong> will look like the following.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>using Google.Authenticator;\nusing GoogleAuthenticatorDemo.Models;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Web;\nusing System.Web.Configuration;\nusing System.Web.Mvc;\nusing System.Web.Security;\n\nnamespace GoogleAuthenticatorDemo.Controllers\n{\n    public class HomeController : Controller\n    {\n        public ActionResult Index()\n        {\n            if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n            {\n                return RedirectToAction(\"Login\");\n            }\n            return View();\n        }\n\n        public ActionResult About()\n        {\n            if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n            {\n                return RedirectToAction(\"Login\");\n            }\n\n            ViewBag.Message = \"Your application description page.\";\n            return View();\n        }\n\n        public ActionResult Contact()\n        {\n            if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n            {\n                return RedirectToAction(\"Login\");\n            }\n\n            ViewBag.Message = \"Your contact page.\";\n            return View();\n        }\n\n        public ActionResult Login()\n        {\n            Session&#91;\"UserName\"] = null;\n            Session&#91;\"IsValidTwoFactorAuthentication\"] = null;\n            return View();\n        }\n\n        &#91;HttpPost]\n        public ActionResult Login(LoginModel login)\n        {\n            bool status = false;\n\n            if (Session&#91;\"Username\"] == null || Session&#91;\"IsValidTwoFactorAuthentication\"] == null || !(bool)Session&#91;\"IsValidTwoFactorAuthentication\"])\n            {\n                string googleAuthKey = WebConfigurationManager.AppSettings&#91;\"GoogleAuthKey\"];\n                string UserUniqueKey = (login.UserName + googleAuthKey);\n\n\n                \/\/Take UserName And Password As Static - Admin As User And 12345 As Password\n                if (login.UserName == \"Admin\" &amp;&amp; login.Password == \"12345\")\n                {\n                    Session&#91;\"UserName\"] = login.UserName;\n\n                    \/\/Two Factor Authentication Setup\n                    TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator();\n                    var setupInfo = TwoFacAuth.GenerateSetupCode(\"UdayDodiyaAuthDemo.com\", login.UserName, ConvertSecretToBytes(UserUniqueKey, false), 300);\n                    Session&#91;\"UserUniqueKey\"] = UserUniqueKey;\n                    ViewBag.BarcodeImageUrl = setupInfo.QrCodeSetupImageUrl;\n                    ViewBag.SetupCode = setupInfo.ManualEntryKey;\n                    status = true;\n                }\n            }\n            else\n            {\n                return RedirectToAction(\"Index\");\n            }\n            ViewBag.Status = status;\n            return View();\n        }\n\n\n        private static byte&#91;] ConvertSecretToBytes(string secret, bool secretIsBase32) =&gt;\n           secretIsBase32 ? Base32Encoding.ToBytes(secret) : Encoding.UTF8.GetBytes(secret);\n\n\n        public ActionResult TwoFactorAuthenticate()\n        {\n            var token = Request&#91;\"CodeDigit\"];\n            TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator();\n            string UserUniqueKey = Session&#91;\"UserUniqueKey\"].ToString();\n            bool isValid = TwoFacAuth.ValidateTwoFactorPIN(UserUniqueKey, token, false);\n            if (isValid)\n            {\n                HttpCookie TwoFCookie = new HttpCookie(\"TwoFCookie\");\n                string UserCode = Convert.ToBase64String(MachineKey.Protect(Encoding.UTF8.GetBytes(UserUniqueKey)));\n\n                Session&#91;\"IsValidTwoFactorAuthentication\"] = true;\n                return RedirectToAction(\"Index\");\n            }\n            ViewBag.Message = \"Google Two Factor PIN is expired or wrong\";\n            return RedirectToAction(\"Login\");\n        }\n\n        public ActionResult Logoff()\n        {\n            Session&#91;\"UserName\"] = null;\n            Session&#91;\"IsValidTwoFactorAuthentication\"] = null;\n            return RedirectToAction(\"Login\");\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 16:<\/strong> Further, navigate to the <strong><em>_Layout.cshtml<\/em><\/strong> page code and modify it with the following block.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta charset=\"utf-8\" \/&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;@ViewBag.Title - My ASP.NET Application&lt;\/title&gt;\n    @Styles.Render(\"~\/Content\/css\")\n    @Scripts.Render(\"~\/bundles\/modernizr\")\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div class=\"navbar navbar-inverse navbar-fixed-top\"&gt;\n        &lt;div class=\"container\"&gt;\n            &lt;div class=\"navbar-header\"&gt;\n                &lt;button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\" title=\"more options\"&gt;\n                    &lt;span class=\"icon-bar\"&gt;&lt;\/span&gt;\n                    &lt;span class=\"icon-bar\"&gt;&lt;\/span&gt;\n                    &lt;span class=\"icon-bar\"&gt;&lt;\/span&gt;\n                &lt;\/button&gt;\n                @Html.ActionLink(\"Application name\", \"Index\", \"Home\", new { area = \"\" }, new { @class = \"navbar-brand\" })\n            &lt;\/div&gt;\n            &lt;div class=\"navbar-collapse collapse\"&gt;\n                &lt;ul class=\"nav navbar-nav\"&gt;\n                    &lt;li&gt;@Html.ActionLink(\"Home\", \"Index\", \"Home\")&lt;\/li&gt;\n                    &lt;li&gt;@Html.ActionLink(\"About\", \"About\", \"Home\")&lt;\/li&gt;\n                    &lt;li&gt;@Html.ActionLink(\"Contact\", \"Contact\", \"Home\")&lt;\/li&gt;\n                &lt;\/ul&gt;\n\n                @if (@HttpContext.Current.Session&#91;\"UserName\"] != null &amp;&amp; @HttpContext.Current.Session&#91;\"IsValidTwoFactorAuthentication\"] != null)\n                {\n                   if(bool.Parse(@HttpContext.Current.Session&#91;\"IsValidTwoFactorAuthentication\"].ToString()) == true)\n                   {\n                        &lt;ul class=\"nav navbar-nav navbar-right\"&gt;\n                            &lt;li style=\"color: White; font-size: 15px; margin-top: 10px; margin-right: 100px;\"&gt;\n                                USER: @HttpContext.Current.Session&#91;\"UserName\"].ToString()\n                            &lt;\/li&gt;\n                            &lt;li&gt;\n                                &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n                                @Html.ActionLink(\"Log Out\", \"Logoff\", \"Home\", new { style = \"color:White; font-size: 15px\" })\n                            &lt;\/li&gt;\n                        &lt;\/ul&gt;\n                   }\n                }\n            &lt;\/div&gt;\n        &lt;\/div&gt;\n    &lt;\/div&gt;\n    &lt;div class=\"container body-content\"&gt;\n        @RenderBody()\n        &lt;hr \/&gt;\n        &lt;footer&gt;\n            &lt;p&gt;&amp;copy; @DateTime.Now.Year - My ASP.NET Application&lt;\/p&gt;\n        &lt;\/footer&gt;\n    &lt;\/div&gt;\n    @Scripts.Render(\"~\/bundles\/jquery\")\n    @Scripts.Render(\"~\/bundles\/bootstrap\")\n    @RenderSection(\"scripts\", required: false)\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 17:<\/strong> To showcase the username on the index page, you will need the below-provided code in your <strong><em>index.cshtml<\/em><\/strong> file. Adding this code block depends on the layout of your page. We have added this feature only because of the default look of the app. Otherwise, you can change it per your needs.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>@{\n    ViewBag.Title = \"Home Page\";\n}\n\n&lt;div class=\"jumbotron\"&gt;\n    &lt;h1&gt;ASP.NET&lt;\/h1&gt;\n    &lt;p class=\"lead\"&gt;ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.&lt;\/p&gt;\n    &lt;p&gt;&lt;a href=\"https:\/\/asp.net\" class=\"btn btn-primary btn-lg\"&gt;Learn more &amp;raquo;&lt;\/a&gt;&lt;\/p&gt;\n&lt;\/div&gt;\n&lt;center&gt;&lt;h2 style=\"color: red;\"&gt;Welcome Mr. @HttpContext.Current.Session&#91;\"UserName\"].ToString()&lt;\/h2&gt;&lt;\/center&gt;\n&lt;div class=\"row\"&gt;\n    &lt;div class=\"col-md-4\"&gt;\n        &lt;h2&gt;Getting started&lt;\/h2&gt;\n\n        &lt;p&gt;\n            ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that\n            enables a clean separation of concerns and gives you full control over markup\n            for enjoyable, agile development.\n        &lt;\/p&gt;\n        &lt;p&gt;&lt;a class=\"btn btn-default\" href=\"https:\/\/go.microsoft.com\/fwlink\/?LinkId=301865\"&gt;Learn more &amp;raquo;&lt;\/a&gt;&lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;div class=\"col-md-4\"&gt;\n        &lt;h2&gt;Get more libraries&lt;\/h2&gt;\n        &lt;p&gt;NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.&lt;\/p&gt;\n        &lt;p&gt;&lt;a class=\"btn btn-default\" href=\"https:\/\/go.microsoft.com\/fwlink\/?LinkId=301866\"&gt;Learn more &amp;raquo;&lt;\/a&gt;&lt;\/p&gt;\n    &lt;\/div&gt;\n    &lt;div class=\"col-md-4\"&gt;\n        &lt;h2&gt;Web Hosting&lt;\/h2&gt;\n        &lt;p&gt;You can easily find a web hosting company that offers the right mix of features and price for your applications.&lt;\/p&gt;\n        &lt;p&gt;&lt;a class=\"btn btn-default\" href=\"https:\/\/go.microsoft.com\/fwlink\/?LinkId=301867\"&gt;Learn more &amp;raquo;&lt;\/a&gt;&lt;\/p&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 18:<\/strong> After all the coding, it\u2019s time to <strong><em>test the application<\/em><\/strong>. Take a mobile phone and download the Google Authenticator app on it. Simultaneously, run the ASP.NET web application.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The app will show you a login, where you need to enter the static username and password, which we defined. In our case, <strong><em>username = admin<\/em><\/strong> and <strong><em>password = 456789<\/em><\/strong>. Further, click on <strong><em>Login<\/em><\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1454\" height=\"491\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/login-page-asp-net-application.png\" alt=\"Login Page ASP.NET Application\" class=\"wp-image-13913\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/login-page-asp-net-application.png 1454w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/login-page-asp-net-application-300x101.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/login-page-asp-net-application-1024x346.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/login-page-asp-net-application-768x259.png 768w\" sizes=\"auto, (max-width: 1454px) 100vw, 1454px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 19:<\/strong> As you click login, the app will generate a <strong><em>QR Code<\/em><\/strong>, requiring a Google Authenticator code to confirm your identity.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1449\" height=\"693\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/manual-setup-qr-code.png\" alt=\"Login Page QR Code\" class=\"wp-image-13914\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/manual-setup-qr-code.png 1449w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/manual-setup-qr-code-300x143.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/manual-setup-qr-code-1024x490.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/manual-setup-qr-code-768x367.png 768w\" sizes=\"auto, (max-width: 1449px) 100vw, 1449px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 20:<\/strong> Open the <strong><em>Google Authenticator<\/em><\/strong> app (<a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.google.android.apps.authenticator2&amp;hl=en&amp;gl=US\" rel=\"nofollow\">get it from here<\/a>) and choose the <strong><em>Scan a QR Code<\/em><\/strong> option.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After scanning the ASP.NET web app QR code will generate a code for you. You should input the generated code in the required field.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"686\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-verification-code.png\" alt=\"Google Authenticator Verification Code\" class=\"wp-image-13912\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-verification-code.png 712w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/google-authenticator-verification-code-300x289.png 300w\" sizes=\"auto, (max-width: 712px) 100vw, 712px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1446\" height=\"702\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/enter-authenticator-code-in-login-page.png\" alt=\"Enter Authenticator Code in Login Page\" class=\"wp-image-13909\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/enter-authenticator-code-in-login-page.png 1446w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/enter-authenticator-code-in-login-page-300x146.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/enter-authenticator-code-in-login-page-1024x497.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/enter-authenticator-code-in-login-page-768x373.png 768w\" sizes=\"auto, (max-width: 1446px) 100vw, 1446px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Final Result:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You successfully log into the application after passing a two-factor authentication mechanism using the Google authenticator app.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1452\" height=\"907\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-welcome-page.png\" alt=\"ASP.NET MVC Welcome Page\" class=\"wp-image-13905\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-welcome-page.png 1452w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-welcome-page-300x187.png 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-welcome-page-1024x640.png 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-welcome-page-768x480.png 768w\" sizes=\"auto, (max-width: 1452px) 100vw, 1452px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Similarly, you can try different username and password combinations to test the unauthorized user functionality. Also, log out from the Admin account to verify the working of the logout method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What You Need To Configure Google Authenticator App With ASP.NET Web Application?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To enable your application to work with the Google authenticator app, you should <a href=\"https:\/\/positiwise.com\/hire-asp-net-developers\">hire ASP.NET developers<\/a>. They can help you with building an avant-garde application with utmost security to prevent unauthorized access and retain data integrity. However, you should only hire developers from an experienced and globally recognized firm, such as Positiwise Software Pvt Ltd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, before you finalize an <a href=\"https:\/\/positiwise.com\/hire\/asp-net-mvc-development-company\">ASP.NET MVC development company<\/a>, ensure that it offers the following benefits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Agile development methodology for fulfilling dynamic requirements<\/li>\n\n\n\n<li>A dedicated team consisting of designers, developers, testers, and QA analysts.<\/li>\n\n\n\n<li>Utilization of top tools for development, communication, and project management.<\/li>\n\n\n\n<li>Flexible pricing model for cost-saving.<\/li>\n\n\n\n<li>NDA signing and assurance of timely software delivery.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The right team of ASP.NET developers will streamline all tasks to configure Google two-factor authentication.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concluding Up on ASP.NET MVC Google Authentication<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ASP.NET MVC Google Authentication is a new-age security mechanism that provides the two-factor authentication benefit to users. It helps to set up an additional layer of security, helping to avoid unauthorized access to resources and data. To configure an ASP.NET MVC Google Authentication web app effortlessly, you need Visual Studio IDE; however, you can use it with any application. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you create your project in the VS IDE, you must create login and logout action methods. These action methods will consist of the logic of generating a QR code for the Google Authenticator app after verifying the account credentials. Further, the authenticator app will scan the QR to generate a code. If the code entered is correct, ASP.NET MVC Google Authentication web will allow the login; otherwise, deny it. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s how two-factor authentication will be implemented in an ASP.NET app using ASP.NET MVC Google Authentication.<\/p>\n  <div class=\"related-post slider\">\r\n        <div class=\"headline\">Related Posts<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg 1200w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-300x200.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-1024x683.jpg 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-768x512.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n        .Net Core vs. Java \u2013 Which One You Should Use for Your Projects?  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"Hire ASP.NET Developers - A Precise Road Map to Employ ASP.NET Developers\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n        Precise Road Map for ASP.NET Developers  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".NET Core vs Node.js: The Difference Explained by Web Expert\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-jpg.webp\" class=\"attachment-full size-full wp-post-image\" alt=\"NET-Core-VS-Node-js\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-jpg.webp 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-300x182.webp 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-768x467.webp 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".NET Core vs Node.js: The Difference Explained by Web Expert\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\">\r\n        .NET Core vs Node.js: The Difference Explained by Web Expert  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 5px;\r\n      padding: 0px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 2rem !important;\r\n      color: #212529 !important;\r\n          }\r\n\r\n    .related-post .headline {\r\nmargin-top: 0;\r\npadding-left: 1%;\r\n}.related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 0px 0px 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 1rem;\r\n      color: #212529;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 13px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 3,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 3,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: true,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: true,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>\r\n","protected":false},"excerpt":{"rendered":"<p>Quick Overview:Verifying the user is now a necessity to maintain data security and allow only authorized users on [&hellip;]<\/p>\n  <div class=\"related-post slider\">\r\n        <div class=\"headline\">Related Posts<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n\r\n      <img width=\"1200\" height=\"800\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg 1200w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-300x200.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-1024x683.jpg 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-768x512.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n        .Net Core vs. Java \u2013 Which One You Should Use for Your Projects?  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n\r\n      <img width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"Hire ASP.NET Developers - A Precise Road Map to Employ ASP.NET Developers\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n        Precise Road Map for ASP.NET Developers  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"A Descriptive Guide to .NET Framework\" href=\"https:\/\/positiwise.com\/blog\/a-descriptive-guide-to-dot-net-framework\">\r\n\r\n      <img width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"A Descriptive Guide to .NET Framework\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"A Descriptive Guide to .NET Framework\" href=\"https:\/\/positiwise.com\/blog\/a-descriptive-guide-to-dot-net-framework\">\r\n        A Descriptive Guide to .NET Framework  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 5px;\r\n      padding: 0px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 2rem !important;\r\n      color: #212529 !important;\r\n          }\r\n\r\n    .related-post .headline {\r\nmargin-top: 0;\r\npadding-left: 1%;\r\n}.related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 0px 0px 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 1rem;\r\n      color: #212529;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 13px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 3,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 3,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: true,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: true,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>\r\n","protected":false},"author":3,"featured_media":13928,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-13893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ASP.NET MVC Google Authentication: Learn How to Integrate<\/title>\n<meta name=\"description\" content=\"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ASP.NET MVC Google Authentication: Learn How to Integrate\" \/>\n<meta property=\"og:description\" content=\"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide\" \/>\n<meta property=\"og:site_name\" content=\"Positiwise\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/positiwise\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-10T08:06:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-27T08:53:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1021\" \/>\n\t<meta property=\"og:image:height\" content=\"621\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Parag Mehta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@positiwise\" \/>\n<meta name=\"twitter:site\" content=\"@positiwise\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Parag Mehta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide\"},\"author\":{\"name\":\"Parag Mehta\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/person\\\/b4b3d9970ea94f5914a615f70345353a\"},\"headline\":\"ASP.NET MVC Google Authentication: A Complete Integration\u00a0Guide\",\"datePublished\":\"2023-10-10T08:06:35+00:00\",\"dateModified\":\"2023-12-27T08:53:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide\"},\"wordCount\":1819,\"publisher\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/asp-net-mvc-google-authentication.jpg\",\"articleSection\":[\".NET Development\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide\",\"name\":\"ASP.NET MVC Google Authentication: Learn How to Integrate\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/asp-net-mvc-google-authentication.jpg\",\"datePublished\":\"2023-10-10T08:06:35+00:00\",\"dateModified\":\"2023-12-27T08:53:55+00:00\",\"description\":\"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#primaryimage\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/asp-net-mvc-google-authentication.jpg\",\"contentUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/asp-net-mvc-google-authentication.jpg\",\"width\":1021,\"height\":621,\"caption\":\"ASP.NET MVC Google Authentication\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/asp-net-mvc-google-authentication-guide#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/positiwise.com\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ASP.NET MVC Google Authentication: A Complete Integration\u00a0Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/\",\"name\":\"Positiwise\",\"description\":\"Providing Full-cycle Software Development Services\",\"publisher\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"},\"alternateName\":\"Positiwise Software Pvt Ltd\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\",\"name\":\"Positiwise\",\"alternateName\":\"Positiwise Software Pvt Ltd\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"width\":202,\"height\":29,\"caption\":\"Positiwise\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/positiwise\\\/\",\"https:\\\/\\\/x.com\\\/positiwise\",\"https:\\\/\\\/github.com\\\/positiwise\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/positiwise\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/person\\\/b4b3d9970ea94f5914a615f70345353a\",\"name\":\"Parag Mehta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"caption\":\"Parag Mehta\"},\"description\":\"Parag Mehta, the CEO and Founder of Positiwise Software Pvt Ltd has extensive knowledge of the development niche. He is implementing custom strategies to craft highly-appealing and robust applications for its clients and supporting employees to grow and ace the tasks. He is a consistent learner and always provides the best-in-quality solutions, accelerating productivity.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/paragcmehta\"],\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/author\\\/parag-mehta\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ASP.NET MVC Google Authentication: Learn How to Integrate","description":"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide","og_locale":"en_US","og_type":"article","og_title":"ASP.NET MVC Google Authentication: Learn How to Integrate","og_description":"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.","og_url":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide","og_site_name":"Positiwise","article_publisher":"https:\/\/www.facebook.com\/positiwise\/","article_published_time":"2023-10-10T08:06:35+00:00","article_modified_time":"2023-12-27T08:53:55+00:00","og_image":[{"width":1021,"height":621,"url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg","type":"image\/jpeg"}],"author":"Parag Mehta","twitter_card":"summary_large_image","twitter_creator":"@positiwise","twitter_site":"@positiwise","twitter_misc":{"Written by":"Parag Mehta","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#article","isPartOf":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide"},"author":{"name":"Parag Mehta","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/person\/b4b3d9970ea94f5914a615f70345353a"},"headline":"ASP.NET MVC Google Authentication: A Complete Integration\u00a0Guide","datePublished":"2023-10-10T08:06:35+00:00","dateModified":"2023-12-27T08:53:55+00:00","mainEntityOfPage":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide"},"wordCount":1819,"publisher":{"@id":"https:\/\/positiwise.com\/blog\/#organization"},"image":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#primaryimage"},"thumbnailUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg","articleSection":[".NET Development"],"inLanguage":"en-US","copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/positiwise.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide","url":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide","name":"ASP.NET MVC Google Authentication: Learn How to Integrate","isPartOf":{"@id":"https:\/\/positiwise.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#primaryimage"},"image":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#primaryimage"},"thumbnailUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg","datePublished":"2023-10-10T08:06:35+00:00","dateModified":"2023-12-27T08:53:55+00:00","description":"Learn how to integrate Google authentication into your ASP.NET MVC application for secure and convenient user login using OAuth.","breadcrumb":{"@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#primaryimage","url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg","contentUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/10\/asp-net-mvc-google-authentication.jpg","width":1021,"height":621,"caption":"ASP.NET MVC Google Authentication"},{"@type":"BreadcrumbList","@id":"https:\/\/positiwise.com\/blog\/asp-net-mvc-google-authentication-guide#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/positiwise.com\/blog"},{"@type":"ListItem","position":2,"name":"ASP.NET MVC Google Authentication: A Complete Integration\u00a0Guide"}]},{"@type":"WebSite","@id":"https:\/\/positiwise.com\/blog\/#website","url":"https:\/\/positiwise.com\/blog\/","name":"Positiwise","description":"Providing Full-cycle Software Development Services","publisher":{"@id":"https:\/\/positiwise.com\/blog\/#organization"},"alternateName":"Positiwise Software Pvt Ltd","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/positiwise.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/positiwise.com\/blog\/#organization","name":"Positiwise","alternateName":"Positiwise Software Pvt Ltd","url":"https:\/\/positiwise.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/07\/logo.png","contentUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/07\/logo.png","width":202,"height":29,"caption":"Positiwise"},"image":{"@id":"https:\/\/positiwise.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/positiwise\/","https:\/\/x.com\/positiwise","https:\/\/github.com\/positiwise","https:\/\/www.linkedin.com\/company\/positiwise"]},{"@type":"Person","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/person\/b4b3d9970ea94f5914a615f70345353a","name":"Parag Mehta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","caption":"Parag Mehta"},"description":"Parag Mehta, the CEO and Founder of Positiwise Software Pvt Ltd has extensive knowledge of the development niche. He is implementing custom strategies to craft highly-appealing and robust applications for its clients and supporting employees to grow and ace the tasks. He is a consistent learner and always provides the best-in-quality solutions, accelerating productivity.","sameAs":["https:\/\/www.linkedin.com\/in\/paragcmehta"],"url":"https:\/\/positiwise.com\/blog\/author\/parag-mehta"}]}},"_links":{"self":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/13893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/comments?post=13893"}],"version-history":[{"count":12,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/13893\/revisions"}],"predecessor-version":[{"id":14652,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/13893\/revisions\/14652"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/media\/13928"}],"wp:attachment":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/media?parent=13893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/categories?post=13893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/tags?post=13893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}