QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • Home
  • QIdea
  • QTrack
Home Carbon Ads Authenticating using Touch ID in Intel XDK

Authenticating using Touch ID in Intel XDK

touch-id

This post is a part 39 of Intel XDK Complete Tutorial post series.

From iPhone 5S onwards Apple introduced fingerprint scanner which lets applications verify if the user is the phone owner. In future Apple may allow apps to take raw fingerprints and provide some other information.

Now Intel XDK apps can make use of the fingerprint scanner to verify user ownership if the app is running in iPhone 5S or higher. It also requires iPhone to have iOS 8+ operating system running.

Touch ID Plugin

To use iPhone fingerprint scanner you need to include Touch ID plugin in your app.

Screen Shot 2014-12-31 at 5.25.25 pm

Authenticating User Ownership

Here is the JavaScript code to authenticate if user is device owner or not

document.addEventListener("intel.xdk.device.ready",function(){
    if(intel.xdk.device.platform == "iOS")
    {
        window.touchid.checkSupport(function(){
            //fingerprint supported
            window.touchid.authenticate(function(){
                alert("Authentication Passed");
            }, function(){
                alert("Authentication Failed");
            }, "Are you the device owner?");
        }, function(){
            //fingerprint not supported. Use some other way to verify ownership
        });
    }
    else
    {
        //fingerprint not supported. Use some other way to verify ownership
    }
},false);

Here is how it looks

final_app

Testing

You cannot test this code in emulator or app preview. You have to build iOS binary to test it on real device. Third party plugins don’t work in legacy apps therefore you have to build a cordova hybrid app.

Dec 31, 2014Narayan Prusty
Detect Shake using JavaScriptBuilding Intel XDK APP for Adhoc and App Store
Comments: 2
  1. abc
    5 years ago

    can we used this intel xdk for securing iot devices? and how?

    ReplyCancel
  2. Rafael Augusto
    7 years ago

    Friend, I am trying to run my test with my iphone 5s by the intel App Preview application, however not appear to stall touchID, you tell me the intel opening the app not even wheel? I have to send to the AppleStore and run on the mobile phone?

    ReplyCancel

Leave a Reply to abc Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Narayan Prusty

I am a software engineer specialising in Blockchain, DevOps and Go/JavaScript. This is my personal blog where I write about things that I learn and feel interesting to share.

Image8 years ago 2 Comments Cordova
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
  • Touch ID Plugin
  • Authenticating User Ownership
  • Testing
Related Articles
  • Push Notifications in Intel XDK using pushMobi
  • Retrieve Device Information Using Intel XDK
  • Publishing Intel XDK App to App Store
  • Install or Run a App using Intel XDK
  • Accessing User Phone Contacts using Intel XDK
Our Sponsor
My Books

2014 - 2015 © QNimate
All tutorials MIT license