Register New Fingerprint

Verifying a new fingerprint

Along with OAuth, we also use device fingerprints for authentication. Fingerprints are used to identify the device that is trying to access a user's information. You need to supply fingerprints when you create a user. The fingerprint supplied during the POST User creation is the registered fingerprint associated with the user.

Additionally, you can incorporate two-factor authentication ("2FA") into your user login process when your user connects with a different device. To do so, just supply the new, non-verified fingerprint.

If the user supplies a non-verified fingerprint during login, the user will be directed to the 2FA flow. We return the linked phone numbers in the API call response with key phone_numbers. You can let the user select the phone number from that list and then make the API call again by specifying the phone_number you want the 2FA to be sent. This will trigger the 2FA protocol and a PIN will be sent to the selected phone number. The user will be able to verify the device via this API call itself. You can supply validation_pin under the user object and the verification will be triggered.

If you wish to register a new device fingerprint to the user account and use our two-factor authentication (2FA) security protocols, complete the following steps:

Step 1: Supply the new fingerprint.

POST /v3.1/oauth/594e0fa2838454002ea317a0 HTTP/1.1
Host: uat-api.synapsefi.com
X-SP-GATEWAY: client_id_2bb1e412edd311e6bd04e285d6015267|client_secret_2bb1e714edd311e6bd04e285d6015267
X-SP-USER-IP: 127.0.0.1
X-SP-USER: |e83cf6ddcf778e37bfe3d48fc78a6502062fcxx
Content-Type: application/json

{
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq"
}
{
    "error": {
        "en": "Fingerprint not registered. Please perform the MFA flow."
    },
    "error_code": "10",
    "http_code": "202",
    "phone_numbers": [
        "[email protected]",
        "901-111-2222"
    ],
    "success": false
}
client.update_headers(fingerprint='e83cf6ddcf778e37bfe3d48fc78a6502062fcxx')

user.oauth()
const newFingerprint = 'myNewFingerprint123';

user.registerNewFingerprint(newFingerprint);
fp = 'e83cf6ddcf778e37bfe3d48fc78a6502062fcxx'

client.update_headers(fingerprint: fp )

user.authenticate()
$body = (object) [
   "refresh_token" => "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq"
];

$user->ouath($body);
data, err := user.authenticate(`{
     “refresh_token”: “refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq”,
     “Scope”: [
         “USER|PATCH”,
         “USER|GET”,
         ...
     ]
  }`)

Step 2: Supply 2FA device from the list.

POST /v3.1/oauth/594e0fa2838454002ea317a0 HTTP/1.1
Host: uat-api.synapsefi.com
X-SP-GATEWAY: client_id_2bb1e412edd311e6bd04e285d6015267|client_secret_2bb1e714edd311e6bd04e285d6015267
X-SP-USER-IP: 127.0.0.1
X-SP-USER: |e83cf6ddcf778e37bfe3d48fc78a6502062fcxx
Content-Type: application/json

{
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "phone_number":"[email protected]"
}
{
    "error_code": "10",
    "http_code": "202",
    "message": {
        "en": "MFA sent to [email protected]"
    },
    "success": true
}
user.select_2fa_device('[email protected]')
const newFingerprint = 'myNewFingerprint123';
const device2FA = '[email protected]';

user.supplyDevice2FA(newFingerprint, device2FA);
user.select_2fa_device(device: "[email protected]")
$body = (object) [
   "refresh_token" => "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
   "phone_number":"[email protected]"
];

$oauthpayload = $user->select_2fa_device($body);
data, err := user.Select2FA("[email protected]")

Step 3: Verify the PIN sent to the 2FA device.

POST /v3.1/oauth/594e0fa2838454002ea317a0 HTTP/1.1
Host: uat-api.synapsefi.com
X-SP-GATEWAY: client_id_2bb1e412edd311e6bd04e285d6015267|client_secret_2bb1e714edd311e6bd04e285d6015267
X-SP-USER-IP: 127.0.0.1
X-SP-USER: |e83cf6ddcf778e37bfe3d48fc78a6502062fcxx
Content-Type: application/json

{
    "refresh_token":"refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "validation_pin":"594230"
}
{
    "client_id": "589acd9ecb3cd400fa75ac06",
    "client_name": "SynapseFI",
    "expires_at": "1498297791",
    "expires_in": "7200",
    "oauth_key": "oauth_vxGS10t7OQzBoVJIM4Z0rbnjyXsc8lCigaH6ewRp",
    "refresh_expires_in": 6,
    "refresh_token": "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
    "scope": [
        "USER|PATCH",
        "USER|GET",
        "NODES|POST",
        "NODES|GET",
        "NODE|GET",
        "NODE|PATCH",
        "NODE|DELETE",
        "TRANS|POST",
        "TRANS|GET",
        "TRAN|GET",
        "TRAN|PATCH",
        "TRAN|DELETE"
    ],
    "user_id": "594e0fa2838454002ea317a0"
}
user.confirm_2fa_pin('594230')
const newFingerprint = 'myNewFingerprint123';
const validationPin = '123456';

user.verifyFingerprint2FA(newFingerprint, validationPin);
user.confirm_2fa_pin(pin: "594230")
$body = (object) [
   "refresh_token" => "refresh_ehG7YBS8ZiD0sLa6PQHMUxryovVkJzElC5gWROXq",
   "pin":"594230"
];

$oauthpayload = $user->confirm_2fa_pin($body);
data, err := user.Verify2FA(“594230”)

Don't want to trigger 2FA? (NOT RECOMMENDED)

We strongly recommend using 2FA or some form of MFA within your authentication process.

If you do not want to use our 2FA, store the fingerprint used when creating the user and supply the fingerprint when performing actions with the user. This way the system will not detect a new device and no 2FAs will be triggered.

Alternatively, you can also pass a hashed version of your user_pk+client_id+client_secret. That way the value is still somewhat secret, but you won't need to store it for each unique user.

Testing in Sandbox: Registering a new user fingerprint

Normally when registering a new fingerprint, a random PIN is sent to the specified 2FA device. For testing purposes, it is convenient to know the PIN without checking the 2FA device. If you use this fingerprint the API will always accept the pre-programmed validation PIN.

fingerprint
validation_pin

static_pin

"123456"

Collecting Fingerprints on Different Devices

Web Browsers

To collect fingerprints on the web, our suggestion is to use Valve's Fingerprint.js2144. Just import the JS file and do the following:

new Fingerprint2().get(function(result){
  // this will use all available fingerprinting sources
  console.log('This is the fingerprint '+result);
});

iOS

For iOS we suggest using UIDevice currentDevice method. It is relatively straightforward. Here is an example:

#pragma mark - get device ID
- (NSString *)deviceID{
    return [NSString stringWithFormat:@"%@-AAPL",[UIDevice currentDevice].identifierForVendor.UUIDString];
}

Android

For android we suggest using a logic like the following:

public static String getDeviceID(Context activity) {
        String androidID = Settings.Secure.getString(activity.getContentResolver(),Settings.Secure.ANDROID_ID);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(Build.MANUFACTURER.toUpperCase()+"-");
        stringBuilder.append(Build.MODEL+"-");
        stringBuilder.append(androidID);
        stringBuilder.append("-GOOG");
        androidID = stringBuilder.toString();
        return androidID;
    }