AuthenticatorResponse.clientDataJSON

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The clientDataJSON property of the AuthenticatorResponse interface stores a JSON string in an ArrayBuffer, representing the client data that was passed to CredentialsContainer.create() or CredentialsContainer.get(). This property is only accessed on one of the child objects of AuthenticatorResponse, specifically AuthenticatorAttestationResponse or AuthenticatorAssertionResponse.

Syntax

var arrayBuffer = AuthenticatorAttestationResponse.clientDataJSON;
var arrayBuffer = AuthenticatorAssertionResponse.clientDataJSON;

Value

A ArrayBuffer.

Properties

After the clientDataJSON object 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 AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 67
Full support 67
Full support 65
Notes Disabled
Notes Only supports USB U2F tokens.
Disabled From version 65: this feature is behind the Web Authentication API preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Full support 18Firefox Full support 60
Notes
Full support 60
Notes
Notes Only supports USB U2F tokens.
IE No support NoOpera No support NoSafari No support NoWebView Android Full support 70Chrome Android Full support 70Edge Mobile ? Firefox Android Full support 60
Notes
Full support 60
Notes
Notes Only supports USB U2F tokens.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No 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: jpmedley, ExE-Boss, apowers313
Last updated by: jpmedley,