Universal links issue in case of automatic redirection

Team, we have recently enabled universal links for our app. And our customers started facing one issue during the login flow.

For login we generally open a web view inside the app with <domain>/login url Our login process can be configured with different IDPs, which takes care of authentication and once the authentication is done, IDP gives a callback to our server <domain>/callback.
Once the callback succeeds, web view closes and we receive a token using deeplink of our app. (app://code)

But for some IDPs the callback made to our domain <domain>/callback is received by the app and the login process stops in between. It doesn't happen for all the IDPs, so I am not sure what is going wrong.

From what I know, in case of universal link redirection calls shouldn't open the app and should have been continued in browser then why we are receiving the automatic redirection calls to the app. Is there any response header in the redirection call that decides whether to open the url in web or app?

Universal links issue in case of automatic redirection
 
 
Q