<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Face ID &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/face-id/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Fri, 16 Jul 2021 16:56:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>iOS User Authentication with Face ID</title>
		<link>https://blog.xojo.com/2021/03/31/ios-user-authentication-with-face-id/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 31 Mar 2021 11:56:00 +0000</pubDate>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Face ID]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Xojo API 2.0]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=8283</guid>

					<description><![CDATA[With the new UserAuthentication class available in Xojo 2021 Release 1, you can now easily ask an iOS user to authenticate themselves using Face ID, Touch ID or with their password/passcode. In an iOS project, add a UserAuthentication object to your screen and change its name to Authenticator.]]></description>
										<content:encoded><![CDATA[
<p>With the new <a href="https://documentation.xojo.com/api/ios/userauthentication.html">UserAuthentication</a> class available in Xojo 2021 Release 1, you can now easily ask an iOS user to authenticate themselves using Face ID, Touch ID or with their password/passcode. In an iOS project, add a UserAuthentication object to your screen and change its name to <strong>Authenticator</strong>. It will appear in the tray area at the bottom. Also add a Button, a Label and a TextArea.</p>



<p>On Authenticator, add the AuthenticationSucceeded and Error events. The AuthenticationSucceeded event is called when the authentication request succeeds due to a valid touch, face or password. Put this code in the event to indicate that:</p>



<pre class="wp-block-preformatted">Label1.Text = "Local Authentication"
TextArea1.Text = "Success!"</pre>



<p>The Error event is called should the touch, face or password not be valid. Put this code in the Error event to indicate the failure:</p>



<pre class="wp-block-preformatted">Label1.Text = "Local Authentication"
If error &lt;&gt; Nil Then
  TextArea1.Text = "Error:" + EndOfLine.iOS + error.Message + EndOfLine + _ 
    error.ErrorNumber.ToString
Else
  TextArea1.Text = "Unknown error"
End If</pre>



<p>The button will be used to ask for authentication. Add this code to its Pressed event:</p>



<pre class="wp-block-preformatted">Authenticator.Request("Please verify yourself.", _
  Authenticator.SensorType = UserAuthentication.SensorTypes.None)</pre>



<p>For devices with Face ID, you&#8217;ll also want to go to the Capabilities Editor (click on iOS Build Settings and choose the Advanced tab in the Inspector) to enable User Authentication and click Options to enter a custom message prompt.</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" src="https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-26-at-09.15.12@2x-651x1024.png" alt="" class="wp-image-8295" width="326" height="512" srcset="https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-26-at-09.15.12@2x-651x1024.png 651w, https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-26-at-09.15.12@2x-191x300.png 191w, https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-26-at-09.15.12@2x.png 768w" sizes="(max-width: 326px) 100vw, 326px" /></figure>



<p>You can now run this in the Simulator which actually has a way for you to test authentication. In the Features menu you&#8217;ll see an option for Face ID or Touch ID, depending on the type of Simulator you are running. In that menu, choose Enrolled to activate the appropriate sensor.</p>



<p>In the app, tap the button to request authentication. On a device with Touch ID or Face ID you will get a prompt to authenticate. The prompt will be slightly different the first time you request authentication for the app. For example, this dialog appears the first time you try to authenticate on a Touch ID device:</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-25-at-15.24.01@2x.png" alt="" class="wp-image-8285" width="379" height="483" srcset="https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-25-at-15.24.01@2x.png 758w, https://blog.xojo.com/wp-content/uploads/2021/03/CleanShot-2021-03-25-at-15.24.01@2x-235x300.png 235w" sizes="(max-width: 379px) 100vw, 379px" /></figure>



<p>Go back to the Features menu in the Simulator and choose Matching Touch. You&#8217;ll then see the &#8220;Success!&#8221; text in the label. If you choose Non-matching Touch, iOS will prompt you to try again or enter password (the Simulator accepts anything as the password). Failing too many times or pressing Cancel displays an error in the TextArea.</p>



<p><a href="http://files.xojo.com/BlogExamples/UserAuthentication.xojo_binary_project">Download a sample project</a>.</p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
