TypingDNA Verify 2FA can be integrated in two ways: OIDC for supported Identity and Access Management (IAM) platforms, or the original Standard API integration for standalone and custom authentication flows.
OIDC integration (for IAM platforms)
If you are using Okta, Ping Identity, or Microsoft Entra ID, start with the OIDC integration. Verify 2FA is added to your existing IAM as a 2FA/MFA authentication method, so users can authenticate by typing 4 words instead of relying on a personal phone or separate authentication device.
OIDC works with the IAM's existing authentication policies and fallback methods. It does not require you to build the Verify 2FA flow directly into your application.
Okta
Add TypingDNA Verify 2FA to Okta as an OIDC Identity Provider and authenticator, then include it in your Okta authentication policies.
Add TypingDNA Verify 2FA to PingOne or PingFederate authentication flows. PingOne DaVinci can be used to include Verify 2FA in MFA, password reset, risk authentication, and other flows.
The Standard integration is the original standalone Verify 2FA integration. Use it when you want to add Verify 2FA directly to your own web application without relying on an IAM platform.
The Standard integration uses a TypingDNA backend client together with a frontend JavaScript client and a button or iframe. It can use SMS or email OTP as a Root of Trust (RoT) for enrollment and fallback, or it can be configured without a separate RoT.
PHP Standard integration tutorial
The tutorial below shows how to integrate the Standard version of TypingDNA Verify 2FA into a web application using PHP as the back end. The same steps are also explained in the video.
Prerequisites for the Standard PHP integration
To create a working example of the Standard Verify 2FA integration, the following actions need to be taken.
1. Create an account on typingdna.com. The Verify 2FA
dashboard will provide you with the clientId, secret and applicationId.
2. Create a localhost environment that will run php applications. For this tutorial we will use XAMPP
that can be downloaded from https://www.apachefriends.org/index.html
3. Setup ngrok. Ngrok creates a public url that will be linked to your localhost environment. For
security purposes, TypingDNA Verify 2FA will only run on a public url. Ngrok can be downloaded from the
following link: https://ngrok.com/
Configuration
The first step is to create a simple php demo application that will run on ngrok.
We will first create a file called index.php that we will place in the htdocs location of xampp. This folder
is usually located here: C:\xampp\htdocs
The index.php file will look like this:
Then we will navigate to the ngrok location folder and we will start up the public url with the following
command:
ngrok.exe http 80
This will create a public url that will look something like this:
Once the ngrok link has been created, we will setup this link in our Integration section in the Verify 2FA
Dashboard.
Make sure you enter just the domain name and you do not include https or http in the name.
✓ Correct: ee503c799d3f.ngrok.io
✗ Incorrect: https://ee503c799d3f.ngrok.io
We will start up our XAMPP Apache server.
By accessing our ngrok link, in this case https://ee503c799d3f.ngrok.io we will see the following
page:
Make sure to always use https otherwise TypingDNA Verify 2FA will not work.
In order to generate the TypingDNA Verify 2FA window we will need to add the following javascript to our code:
Next we will add the button that will start the TypingDNA Verify 2FA window.
The javascript "callbackFn" will be called once the TypingDNA Verify 2FA process is completed.
<script>
function callbackFn(payload)
{
window.location.href = "verify_otp.php?otp=".concat(payload['otp']);
}
</script>
TypingDNA Verify 2FA will return a payload that will contain the one time password that is generated. For
simplicity, in this demo we will navigate to another page and we will pass the one time password as a
parameter in the link.
The final version of the index.php will look like this:
Next we will look at the verify_otp.php file. First we will initialize our variable just like we did in
index.php.
<?php
include('TypingDNAVerifyClient.php');
$typingDNAVerifyClient = new TypingDNAVerifyClient($client_id, $application_id, $secret);
?>
In order to validate that the one time password is correct we will use the validateOTP function that will
make an API call to the TypingDNA server if the one time password is correct.
We select the Verify 2FA with TypingDNA button and our TypingDNA Verify 2FA window will appear.
After we complete the instruction from the TypingDNA Verify 2FA button we will be redirected to the
verify_otp.php page where the result will be displayed.
The success value indicates if it was a valid authentication 1 or if it was invalid
0.
For the production environment, in order to be able to send SMS OTPs you will need to integrate with Twilio in the Verify 2FA dashboard. First log in to your Twilio account and then click on the following button from the dashboard: