There are a few potential issues I see here:
Different OTP algorithms - The website may be using a different OTP algorithm than OTP.NET. The most common ones are TOTP (Time-based One-time Password) and HOTP (HMAC-based One-time Password). Make sure you are using the same algorithm in your code as the website.
Different time intervals - For TOTP, the time interval plays a role in the OTP generation. Ensure you are using the same time interval (usually 30 or 60 seconds) in your code as the website.
Different secret keys - The secret key is the most important part of OTP generation. Make sure the key you are using in your code exactly matches the one provided by the website.
Time synchronization issues - For TOTP, any time differences between your system clock and the server clock can cause issues. Try to sync your system time as precisely as possible.
Looking at your code, a few things stand out:
You are using TOTP, but don't specify a time interval. The default is 30 seconds, so if the website is using 60 seconds that would cause a discrepancy.
You generate a new secret key, instead of using the one provided by the website. This will definitely generate different OTPs.
There could be time sync issues, though less likely given that you generate a new OTP every 2 seconds.
My recommendations would be:
Get the secret key from the website and use that exact key in your code.
Specify the time interval, e.g. totp.GenerateTotp(key, 60).
Double check that your system time is precise.
Generate OTPs at the same interval as the website, e.g. every 60 seconds for a T60 key.
Making these changes should resolve the issue and have your code generate the same OTPs as the website.
Good luck to you