How to Automate Okta 2FA

As a QA, i need to automate the log in flow of my application.
Steps as usual
1.Log into the application
2.Get the Okta code
3.Enter the Okta code and authenticate the log in.

I am trying to do this with Python, I just need to know, based on my user id and password how i can get the authentication code via API or any other way, so i can enter that auth code in the UI of my automation script and proceed with testing.

1 Like