Please be aware of the difference between TOTP and HOTP. Visit the following site for an introduction: https://www.onelogin.com/learn/otp-totp-hotp.
Using Google or the Microsoft authenticator:
Note that if you want to support these authenticators you will be limited in the configuration of the TOTP or HOTP code. Both authenticators have build-in restrictions and there are actions available in this component to support these. These action have the suffix "_ForAutenticators".
Enrollment:
These steps are the same for both a TOTP and an HOTP configuration. The only difference with HOTP is that you need to provide a counter as seed.
In all cases you will need to follow these steps;
Validation:
To validate the OTP code you must do the following;
If you can any questions please check the implementation of the Demo first. Please note that this will not show you how to store the secret or token since that is per-application design choice.