Adding device profiling to an authentication API-based application
About this task
Use the following instructions to add device profiling to a web application using the PingOne Protect SDK. For more information about the authentication API, see Authentication API in the PingFederate documentation or PingOne Protect Native SDKs in the PingOne Native SDK documentation.
Steps
-
Implement the Signals SDK by following the steps in PingOne Protect Native SDKs.
-
Configure functions to format the device profile and submit it to the authentication API. Use the following code sample as a guide.
The
pingone-protect-device-profiling.js
assumes you are using the web SDK. If using a mobile device and you want to send thedeviceProfile
check the SDK documentation and use accordingly.function onCompletion(flowId, deviceProfile) { submitDeviceProfile(flowId, deviceProfile); } function submitDeviceProfile(flowId, deviceProfile) { var myHeaders = new Headers(); myHeaders.append("X-XSRF-Header", "test"); myHeaders.append("Content-Type", "application/vnd.pingidentity.submitDeviceProfile+json"); var raw = JSON.stringify({ "signalsSdkDeviceProfile": deviceProfile }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://pf_host:pf_port/pf-ws/authn/flows/" + flowId, requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); }
When the authentication API is in the
DEVICE_PROFILE_REQUIRED
state, your application shouldsubmitDeviceProfile
with the value from theprofileDevice(callback)
method. -
When you complete the steps in Configuring an adapter instance, set the device profiling method. The provider or the adapter can receive the payload sent by the authentication API.
Choose from:
-
If the provider is configured, you must add the payload to the
checkUsernamePassword
requestOptions
API call in the captchaResponse.{ "username": "string", "password": "string", "rememberMyUsername": "boolean", "thisIsMyDevice": "boolean", "captchaResponse": "string" }
-
When using the PingOne Protect IdP Adapter, submit the payload following the
submitDeviceProfile
requestOptions
action of the authentication API.For more information on these options, see Exploring the authentication API in the PingFederate documentation.
-