Application with OIDC is not redirecting to the home page instead landing to the login page

I am having the application works with OIDC protocol with authorization code flow. I have also enabled MFA (Push Notification) also.

Usecase 1:
When I directly access the application using the URL, it first asks for the username, then if not logged in the browser before, it asks for credentials. After credentials provided, it asks for push notification verification. then finally it redirects to home. It is working as expected.

Usecase 2:
Whereas in this Usecase, I am logging in to the Okta first and then from Okta I am launching my application. In this case, it asked for the push notification verification. After verification it is again redirecting to the login page instead of home page. But when I click the login button from my application, it lands to the home page.

Expected: After push notification verification, it should redirect to the landing page.

I using the passport-openidconnect strategy node_module in backend as middleware. In the first case I am getting Access and Refresh token but in second case it is not.

Can someone please help, is there any config to be done at OKTA as I am new to OKTA?

You might want to check and see which login flow you have configured in the Okta developer console.

  1. Log in to the Okta developer console.
  2. Select the application you want to configure the authentication flow for.
  3. Click on the “General” tab.
  4. Under “Login”, look for “Login Flow” and select the flow you want to use.

It sounds like you want to be using “Send ID Token directly to app”.

The “Send ID Token directly to app” flow is an Okta-specific login flow (not part of the OIDC standards). In this flow, the user enters their credentials directly into the application, and the application sends the credentials to Okta for validation. If the user is authenticated, Okta sends an ID token directly to the application, which contains the user’s identity information. The application can then use this ID token to grant access to protected resources.