I am trying to write an automation script using python. But the account has 2 step verification on. The user has asked me to automate that part as well. Is there a way by which I can access this OTP programmatically? This OTP is right now setup in the Microsoft authenticator app, but we can also set this up on other authenticator apps like Google authenticator, if it solves the issue for us. I am not restricted to any programming language. Just looking for solutions to get the OTP.
I tried Microsoft Graph API but I was not able to found anything related to MS authenticator application. If there is a particular Graph API which can fulfill the purpose, please help there.