How to use two factor authorization cookie along with single factor authorization cookie

485 Views Asked by At

I have a web application with singe factor authorization and now have implemented two-factor authorization. I am using the Microsoft Identity for the log-in. The problem is - so far we have used a cookie to remember the user while providing the username and password. Say that as 'signglefactorcookie'. Now on the authenticator application authorization page(TFA), I have added another cookie for the remember me option. Say that as 'twofactorcookie'. Now how can I make my client request for both cookies when I use the below code?

// Check whether there is a valid session or persistent cookie

if(this.User.Identity.IsAuthenticated){
// Move to a landing page
}

Problem scenario

  1. Now the problem is, if I log in to the single-factor authentication page with the correct user name and password and land at the two-factor authentication page.
  2. Open a new tab and try to access the home page getting success since there is a single factor cookie that is recognized which makes the user authorized.

How can I make it in a standard way?

0

There are 0 best solutions below