Automating Authorization Code Flow. Unable to get session token

I was following the following thread Automating Authorization Code Flow , however, I’m not even able to get a session token.
We have a SPA application with the Authorization Code grant type and we have a test user that has a security question as MFA (MFA can’t be completely removed even for the test user).
When I’m trying to call api/v1/authn I get:

“errorCode”: “E0000004”,
“errorSummary”: “Authentication failed”,
“errorLink”: “E0000004”,
“errorId”: “oaeEzqyYkP4RA6tdj8b0pOb7w”,

This Authentication | Okta Developer says that there are only 3 reasons for 401:

  • invalid credentials
  • locked out accounts
  • access denied by sign-on policy
    I am able to login with this user via UI so I don’t think it is an issue. The only difference is the security question but I haven’t found how to pass it (or if I need to) to get the session id.

Is there anything that I’m missing?

Can you log into Okta via the Okta login page with the same credentials you are using? User is a user within Okta (where their password is known in Okta), not Federated from an external IdP/integration, right?