clientDataJSON

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The clientDataJSON object is an ArrayBuffer containing a JSON String of the various browser data that was used for the WebAuthn create() or get() call. It is included in both an AuthenticatorAttestationResponse and an AuthenticatorAssertionResponse within a PublicKeyCredential. The reason for storing the data as a ArrayBuffer rather than a String or an actual JavaScript object is that the object is effectively signed over by the authenticator, and if the order of the properties of the JavaScript object were not preserved then the signature verification would fail.

Syntax

TBD

Properties

After the clientDataJSON is converted from an ArrayBuffer to a JavaScript object, it will have the following properties:

clientDataJSON.type
TBD
clientDataJSON.challenge
TBD
clientDataJSON.origin
TBD
clientDataJSON.tokenBindingId Optional
TBD
clientDataJSON.clientExtensions Optional
TBD
clientDataJSON.authenticatorExtensions Optional
TBD

Examples

function arrayBufferToStr(buf) {
    return String.fromCharCode.apply(null, new Uint8Array(buf));
}

// pk is a PublicKeyCredential that is the result of a create() or get() Promise
var clientDataStr = arrayBufferToStr(pk.clientDataJSON);
var clientDataObj = JSON.parse(clientDataStr);

console.log (clientDataObj.type); // "webauthn.create" or "webauthn.get"
console.log (clientDataObj.challenge); // base64 encoded String containing the original challenge
console.log (clientDataObj.origin); // the window.origin

Specifications

Specification Status Comment
Web Authentication: An API for accessing Public Key Credentials Level 1 Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 65
Notes Disabled
Full support 65
Notes Disabled
Notes Only support USB U2F tokens
Disabled From version 65: this feature is behind the Web Authentication API preference (needs to be set to true). To change preferences in Chrome, visit chrome://flags.
Edge Full support 18Firefox Full support 60
Notes
Full support 60
Notes
Notes Only support USB U2F tokens
IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

Document Tags and Contributors

Contributors to this page: ExE-Boss, apowers313
Last updated by: ExE-Boss,