If you have activated the two-factor authetication option in your WHM and then for some reason you are unable to access WHM cause keeps prompting the two-factor key you can disable the two-factor authentication accessing through SSH as root, use the commands below:
cd /var/cpanel/authn/twofactor_auth
and rename the .json files to something else.
-rw------- 1 root root 55 Aug 16 11:29 issuer_userdata.json_renamed
-rw------- 1 root root 38 Aug 16 11:29 tfa_userdata.json_renamed
Now you must be able to login into WHM with your root username and password, without the two-factor key, the system shouldnt prompt the two-factor key login request.