Hi,
Currently, I’m using the multi factor authentication in my app.
login > 2fa > home
Scan the qrcode from the Google Authenticator, insert the token generated
My idea is store the random token into my database, and then call the stored token to match with the input token, if both match, then will redirect to the home page.
However, I'm facing some issue
-
how to update the latest token when it is expired ( the token will expire every 30 second)
but I don’t need the token always keep on update everytime, I just need it update within the duration the user login in thelogin
page and submit in ‘2fa’ page (between first login [login
]and the second login [2fa
]). when user able to access thehome
then it can stop update -
how to set the expire date to 30 days of the token inserted in
2fa
, then user no need insert the token when they login within the 1-month
01/01/2023 login >> login > 2fa > home
02/01/2023 login >> login > home
29/01/2023 login >> login > home
01/02/2023 login >> login > 2fa > home
15/02/2023 login >> login > home
If there is any idea/advise, kindly share as long as the function is similar to my idea .