Search Results :

×

Two Factor Authentication (2FA) for ASP.NET using Microsoft Authenticator

ASP.NET Two Factor Authentication (2FA) allows you to add an extra layer of security to the default ASP.NET login. With Microsoft Authenticator, users are required to enter a time-based one-time passcode (TOTP) generated by the app after entering their username and password. To explore the available options and integration steps, visit our ASP.NET Two Factor Authentication (2FA) page. This helps confirm the identity of users before granting access to your application. Our ASP.NET 2FA solution supports multiple authentication methods, including Google Authenticator, Duo Authenticator, and more.

  • To install the miniOrange 2FA NuGet package in your .NET application, just install the miniOrange NuGet package on top of your application.
NuGet Package
.NET CLI

PM> NuGet\Install-Package miniOrange.NET.2FA

  • After installing the package, open your browser and navigate to the miniOrange 2FA dashboard using the URL below:
 http(s)<your-dotnet-application-base-url>?admintfaconfig=dashboard
  • A database is required to test and use the miniOrange ASP.NET 2FA plugin, as the plugin stores user and configuration data in the database. Before proceeding, ensure that your application is connected to a valid database and that the required connection string is available in your application's configuration.
  • Select the required connection string from the dropdown and click on the Save Configuration button to configure the database connection for the miniOrange 2FA plugin.
ASP.NET 2FA - Database Connection

  • If the registration page or login page appears, the miniOrange 2FA module has been successfully added to your application.
ASP.NET 2FA - registeration page

  • Register or log in with your account by clicking the Register button to configure the module.
  • After successful registration, you will receive a trial license key on your registered email address.
  • To activate the module, you can either:
    • Enter the license key received via email in the provided input field.

    OR

    • Upload the license file using the Choose File button that you downloaded by clicking on the Download it from here link.
ASP.NET Framework Verify Trial License

  • Then, check the box "I have read the above conditions and I want to activate the license", and click the Activate License button.
ASP.NET Framework Activate License
  • After successful license activation, the plugin dashboard will open as shown below.
ASP.NET 2FA Dashboard

  • Click on the Configure button under the Microsoft Authenticator to configure Microsoft Authenticator as the 2FA method for your users.
ASP.NET 2FA Microsoft Authenticator

  • To register your device, scan the QR Code below using the Microsoft Authenticator App or use the client secret code.
  • After scanning the QR, a six-digit token will be generated in the Microsoft Authenticator App. Please enter the code below and click on the Verify button to validate
Microsoft Authenticator - Scan QR Code

  • Once the Microsoft Authenticator method is configured, it can be enabled for the end user.
Microsoft Authenticator - Method Configured

  • After configuring the Microsoft Authenticator method, click on the 2FA Settings button to configure the application settings required for 2FA.
  • If your application uses session variables to store user information, enable the Is Session Available? toggle. Then enter the appropriate values for the Session Username Key, Session Email Key, and Session Phone Key, and click on the Save Settings button.
OTP over SMS - Session Variable

  • Add the following code to your AccountController.cs file and make sure the session keys used in the code match the values configured in the plugin settings.
 Session["username"] = username;
 Session["email"] = userEmail;
 if (!string.IsNullOrEmpty(userPhone))
 {
   Session["phone"] = userPhone;
 }
  • If your application does not use session variables to store user information, you can leave the Is Session Available? toggle disabled and proceed with the remaining configuration.
  • Ensure that the Enable 2FA toggle button is enabled before logging in as an end user.
OTP over SMS - Enable 2FA
  • After login, end users see the Setup 2FA screen. Click Configure beside Microsoft Authenticator.
Microsoft Authenticator - Setup 2FA

  • Scan the QR code using the Microsoft Authenticator app or enter the secret key manually. Then, enter the generated passcode and click on the Verify button.
Microsoft Authenticator - End User Scan QR Code

  • On subsequent logins, enter the passcode generated by the Microsoft Authenticator app and click on the Validate button.
Microsoft Authenticator - End User Validate OTP

  • The user will be logged in to their application.

 Thank you for your response. We will get back to you soon.

Something went wrong. Please submit your query again

We'll Reach Out to You at the Earliest!


ADFS_sso ×
Hello there!

Need Help? We are right here!

support