1

I am researching hybrid app alternatives. One of the things I am looking into is the use for a native app with UIWebView showing the app's content. Upon the user pressing a login button (which triggers a JS call) the app takes over this call and asks if the user wants to use Touch ID to login.

I have seen this in some casino apps (such as this one) and am wondering how that works.

From what I understand is, the native app with the UIWebView intercepts the JS action and (if Touch ID is stored) it will take over. If no Touch ID is stored it will continue with the JS call. Upon success the native app will take over and ask to user if he/she wants to store the credentials using TouchID; afterwards it will continue with the JS call. No changes in the website are needed.

Unfortunately I can't find any information about how that works and any code examples on how to intercept the javascript calls and "manipulate" the action.

Update I understand that my question might be a bit too vague, I've updated it.

Paul Peelen
  • 10,073
  • 15
  • 85
  • 168
  • 1
    I found another question that kind of answered mine, so I have voted to close with regards to: http://stackoverflow.com/questions/13254751/ios-uiwebviewdelegate-intercept-javascript-calls – Paul Peelen Oct 06 '15 at 07:25
  • 2
    admirable behavior, voting to close one's own question. I reward that, and vote to close... :- ) – Paul Cezanne Oct 06 '15 at 15:51

1 Answers1

2

I haven't done this myself but I'd tackle it this way:

  1. Provide/show your login screen as normal.
  2. Once logged in, determine if Touch ID is available.
  3. If Touch ID is available, ask the user if they'd like to use Touch ID.
  4. If the user answers yes, store the credentials in the Keychain along with a flag (could be in NSUserDefaults) indicating Touch ID is enabled.
  5. On subsequent logins, check the Touch ID flag from the point above, if it is YES display the Touch ID prompt using Local Authentication.
  6. If the Local Authentication is successful, use the previously stored credentials to login.
Steve Wilford
  • 8,894
  • 5
  • 42
  • 66