Search code examples
iosazureoauthios-universal-linkssfsafariviewcontroller

What is the difference between tapping keyboard "Go" button and web page button


TL;DR

I'm trying to understand what is the difference between user tapping "Go" button on software keyboard and tapping "Sign In" button rendered on authentication web page when using SFSafariViewController to authenticate user via Azure or any other OAuth provider.

Description

  • We're using various OAuth providers (Azure, Keycloack to name a few) to authenticate users to our native iOS application.
  • We present to a user, browser instance (SFSafariViewController) with login page
  • This page contains username, password fields and a button to sign in
  • When user is entering the password - he/she can either use Log In button on the page or Go button on the iOS software keyboard
  • In both cases login procedure will be triggered and user will be redirected back to proper URL
  • However, if user taps Go button on the software keyboard, application is not being notified about redirect (universal link logic doesn't work) and redirect URL page is being rendered inside SafariViewController
  • It happens in various OAuth providers and can be reproduced only on iOS (when using Android software keyboard button, universal link behaves fine)

We're handling this situation right now by creating special redirect page, which contains special link to a user to tap. Something like "Tap here if you're not automatically redirected back to the application". But I was wondering if there is better solution to this and what is the difference from the OS/Browser perspective between user tapping software keyboard button and HTML page element.


Solution

  • Your workaround seems reasonable.

    About activating Universal Links when user navigates from keyboard: this case seems to be similar to situation when user types some URL to browser's address bar and tap GO. If user doing this, than the user intent is to stay in browser, not go to the App. So it is logical to not engage Universal Links.

    One more way to make better experience for this case: if user navigated to "special redirect page" on iPhone, try to navigate to customURLScheme URL of your App. At this point you already know that the App is installed on this device. Trying to navigate to customURLScheme URL will bring up iOS system dialog, like "Do you want to open XYZ App?". Still this seems a bit better than "Tap here if you're not automatically redirected back to the application".

    Probably you already found out that "special redirect page" should be located on different domain than "Universal Links enabled domain". Navigating inside the same domain will not engage Universal Links. For reference, App Preview page that we have, serves essentially the same purpose as yours "special redirect page".