web api static method
IdentityCredential: disconnect() static method
Limited availabilitySecure context
The disconnect() static method of the IdentityCredential interface disconnects a specified federated sign-in account from the IdP used to obtain the credential.
Afterwards, using that account for federated login requires starting the federated sign-in process again.
Syntax
IdentityCredential.disconnect(options)
Parameters
options- : An options object, which can contain the following properties:
accountHint- : A string specifying an account hint that the IdP uses to identify the account to disconnect. The hint can be an arbitrary string as long as the disconnect endpoint can identify the account — for example an email address or user ID. This will not necessarily match the account ID provided by the accounts list endpoint.
clientIdconfigURL- : A string specifying the config file URL of the IdP, as specified in the
providersconfigURLproperty during sign-in.
- : A string specifying the config file URL of the IdP, as specified in the
- : An options object, which can contain the following properties:
Return value
A Promise that fulfills with undefined.
Exceptions
InvalidStateErrorDOMException- : Thrown if:
- The IdP’s
configURLis invalid or missing thedisconnect_endpoint. - The document’s origin does not match the
configURL.
- The IdP’s
- : Thrown if:
NetworkErrorDOMException- : Thrown if:
- The browser is unable to connect to the IdP.
- The request is disallowed by a
connect-srcContent-Security-Policy. - Another
disconnect()call was previously made that has not yet resolved. - The FedCM API has been disabled globally.
- The IdP’s
configURLis neither secure nor potentially trustworthy.
- : Thrown if:
NotAllowedErrorDOMException- : Thrown if the embedding
<iframe>does not have anidentity-credentials-getPermissions-Policy set to allow the use ofdisconnect()or if the FedCM API is disabled globally by a policy set on the top-level document.
- : Thrown if the embedding
Examples
Basic disconnect() usage
The RP may disconnect a specified federated sign-in account from the associated IdP by invoking disconnect(). This function can be called from a top-level RP frame.
IdentityCredential.disconnect({
configURL: "https://idp.example.com/config.json",
clientId: "rp123",
accountHint: "account456",
});
For a disconnect() call to work, the IdP must include a disconnect_endpoint in its config file. See The disconnect endpoint for more details of the underlying HTTP communication.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- Federated Credential Management API on developer.chrome.com (2023)