10

I'd like to capture a redirect that occurs in a Chrome Custom tab to ensure the user stays in a native mobile application.

Here's how the Chrome Custom Tab is launched:

val url = "https://demo.company.com/sso/oidc/start/?idp_connection_id=Username-Password-Authentication&status_response_url=https://member.example.com/urgent"
val builder = CustomTabsIntent.Builder()                                                                                                                                         
val customTabsIntent = builder.build()                                                                                                                                           
customTabsIntent.launchUrl(this, Uri.parse(url))

That web page redirects to the URL given as the status_response_url parameter after the user authenticates. The mobile app registers for the appropriate scheme:

 <intent-filter android:autoVerify="true">
     <action android:name="android.intent.action.VIEW" />
     <category android:name="android.intent.category.DEFAULT" />
     <category android:name="android.intent.category.BROWSABLE" />
     <data
         android:host="member.example.com"
         android:scheme="https" />
  </intent-filter>

Unfortunately, the system does not seem to capture the redirect. Why?

Orbit
  • 2,985
  • 9
  • 49
  • 106
  • I think you should use `https://demo.company.com` as your host instead of `member.example.com` –  Nov 16 '21 at 11:39
  • https://github.com/openid/AppAuth-Android/issues/353#issuecomment-399799189 please check it, if u use automatic redirecting, chrome will not request your app for security reason. – dinhlam Nov 21 '21 at 13:36

1 Answers1

4

This is a well known problem with App Links and SSO, due to the lack of a user gesture.

You are using the preferred Claimed HTTPS Schemes option but an interstitial web page is needed for it to work reliably.

My blog post has further info on this, including a code sample you can run to review the UX.

Gary Archer
  • 22,534
  • 2
  • 12
  • 24