IdentityCredential: disconnect() static method
FedCM API
FedCM API
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
```js-nolint
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](/docs/Web/API/FedCM_API/IDP_integration#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](/docs/Web/API/FedCM_API/IDP_integration#the_accounts_list_endpoint).
- `clientId`
- : A string specifying the RP's client identifier, as specified in the `providers` [`clientId`](/docs/Web/API/IdentityCredentialRequestOptions#clientid) property during sign-in.
- `configURL`
- : A string specifying the config file URL of the IdP, as specified in the `providers` [`configURL`](/docs/Web/API/IdentityCredentialRequestOptions#configurl) property during sign-in.
### Return value
A Promise that fulfills with undefined.
### Exceptions
- `InvalidStateError` DOMException
- : Thrown if:
- The IdP's `configURL` is invalid or missing the `disconnect_endpoint`.
- The document's origin does not match the `configURL`.
- `NetworkError` DOMException
- : Thrown if:
- The browser is unable to connect to the IdP.
- The request is disallowed by a [`connect-src`](/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/connect-src) Content-Security-Policy.
- Another `disconnect()` call was previously made that has not yet resolved.
- The FedCM API has been disabled globally.
- The IdP's `configURL` is neither secure nor [potentially trustworthy](/docs/Web/Security/Defenses/Secure_Contexts#potentially_trustworthy_origins).
- `NotAllowedError` DOMException
- : Thrown if the embedding `<iframe>` does not have an identity-credentials-get [Permissions-Policy](/docs/Web/HTTP/Guides/Permissions_Policy) set to allow the use of `disconnect()` or if the FedCM API is disabled globally by a policy set on the top-level document.
## 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.
```js
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`](/docs/Web/API/FedCM_API/IDP_integration#disconnect_endpoint) in its config file. See [The disconnect endpoint](/docs/Web/API/FedCM_API/IDP_integration#the_disconnect_endpoint) for more details of the underlying HTTP communication.
## Specifications
## Browser compatibility
## See also
- [Federated Credential Management API](https://developer.chrome.com/docs/identity/fedcm/overview) on developer.chrome.com (2023)
Cite this
"IdentityCredential: disconnect() static method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/IdentityCredential/disconnect_static JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy