External IDP redirect back to mobile app

I have a web and mobile app, We use okta with external IDP.
The problem is that when user tries to login to the mobile app, after entering credentials on the IDP page it redirects him to the web app instead of the mobile app.
Is it possible to redirect to different platforms - if the user logs in to the web app - redirect to the web app, if he logs in to the mobile app - redirect to the mobile app?

Hello,
Can you give more detail on the application setup.

  • Are you using one of the Okta mobile SDKs
    • if so which one
  • Does the mobile application use a browser or a WebView
  • Are you using IdP discovery, or do you redirect to the Okta Login and have external IdP buttons as an option.

If you can give us much details about the application native/web, the platform, SDKs, the flow from start to finish that would be helpful.

Hi,
We have web app, android and ios apps.
We use the okta sign-in widget, in the android app it is opened by google-custom-tabs, and in the ios app it is opened by WKWebView.
We use IDP discovery.
The behavior I described is the same in for both platforms: the user click on sign-in button on the native mobile app, then the browser/WKWebView is opened, and immediately okta redirects to the idp page. then the user enters credentials, and is redirected to the our web application. we want to change this, to redirect him back to the mobile app.