IdentityCredentialError: IdentityCredentialError() constructor

Note: This feature is available in Web Workers.

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

The IdentityCredentialError() constructor creates a new IdentityCredentialError object.

Syntax

js
new IdentityCredentialError()
new IdentityCredentialError(message)
new IdentityCredentialError(message, options)

Parameters

message

A description of the error. If not present, the empty string '' is used.

options Optional

An object that can have the following properties:

error Optional

A string. This can be either one of the values listed in the OAuth 2.0 specified error list or an arbitrary string.

url Optional

A URL pointing to human-readable information about the error to display to users, such as how to fix the error or contact customer service.

Examples

js
try {
  const cred = await navigator.credentials.get({
    identity: {
      providers: [
        {
          configURL: "https://idp.example/manifest.json",
          clientId: "1234",
        },
      ],
    },
  });
} catch (e) {
  const error = e.error;
  const url = e.url;
}

Specifications

Specification
Federated Credential Management API
# dom-identitycredentialerror-identitycredentialerror

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
IdentityCredentialError() constructor
Experimental
Chrome – Full support
Chrome 120 (Release date: 2023-12-05)
footnote Full support
Edge – Full support
Edge 120 (Release date: 2023-12-07)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 106 (Release date: 2023-12-19)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 120 (Release date: 2023-12-05)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 80 (Release date: 2024-01-25)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 25 (Release date: 2024-04-24)
footnote Full support
WebView Android – Full support
WebView Android 120 (Release date: 2023-12-05)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

See also