# Client Secret Rotation

Learn how to rotate the client secret of a FusionAuth Application or Entity.

> For the index of this section of the site, see [llms.txt](https://fusionauth.io/docs/llms.txt)

Confidential OAuth clients authenticate to FusionAuth with a client secret during grants such as the [authorization code grant](https://fusionauth.io/docs/authentication/oauth/authorization-code.md) and the [client credentials grant](https://fusionauth.io/docs/authentication/oauth/client-credentials.md). FusionAuth can also sign an `id_token` with the client secret. To rotate a client secret, generate a new secret, then update FusionAuth and every client that uses the secret.

For the other kinds of secrets, see [Key Rotation](https://fusionauth.io/docs/security/tokens-and-keys/key-rotation.md).

## Plan for a Single Secret

An Application or Entity has one client secret at a time. FusionAuth rejects the old secret as soon as you save the new secret, so clients fail until they switch. For a feature request to support a grace period for client secrets, see [issue 1361](https://github.com/FusionAuth/fusionauth-issues/issues/1361).

To avoid failed requests during the switch, build each client to accept several secrets and try each secret in turn. Alternatively, rotate during a maintenance window.

## Rotate a Client Secret

Suppose an Application uses client secret `A`. To rotate client secret `A`:

1.  Generate a new random string, `B`. Make `B` long and high entropy, because FusionAuth can sign an `id_token` with the client secret. For more information, see the [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#SymmetricKeyEntropy).
2.  Store `B` in your secrets manager, and record when you put `B` into service.
3.  Give `B` to every web application, mobile application, and script that uses client secret `A`. A client that accepts several secrets keeps `A` until FusionAuth switches.
4.  Set the client secret of the Application to `B`. With the [Applications API](https://fusionauth.io/docs/apis/applications.md), send a `PATCH` or `PUT` request that updates **`application.oauthConfiguration.clientSecret`**. For an Entity, use the [Entities API](https://fusionauth.io/docs/apis/entities.md) or Entity Management -> Entities in the Admin UI.
5.  Remove `A` from every client.

## Confirm the Rotation

Complete a login or a client credentials grant with client secret `B`, and confirm that FusionAuth returns tokens. Then confirm that the same request with client secret `A` fails.

Related

[Security Key Rotation Learn about the keys and secrets FusionAuth uses, and how rotation differs for each one. key rotationclient secret rotationsecret rotation](https://fusionauth.io/docs/security/tokens-and-keys/key-rotation.md)

[Security API Key Rotation Learn how to rotate FusionAuth API keys without interrupting the scripts and servers that use them. key rotationsecret rotationsecurity](https://fusionauth.io/docs/security/tokens-and-keys/api-key-rotation.md)

[Security Signing Key Rotation Learn how to rotate the keys FusionAuth uses to sign JWTs, SAML responses, and webhook events. key rotationsecuritydefense in depth](https://fusionauth.io/docs/security/tokens-and-keys/signing-key-rotation.md)

[Security Security Learn how to protect user accounts, credentials, and tokens in applications that use FusionAuth. securitykey rotation](https://fusionauth.io/docs/security.md)
---

## Other pages in Tokens And Keys

> For the full index of this section, see [Security](https://fusionauth.io/docs/llms-security.txt).

- [API Key Rotation](https://fusionauth.io/docs/security/tokens-and-keys/api-key-rotation.md): Learn how to rotate FusionAuth API keys without interrupting the scripts and servers that use them.
- [Key Master](https://fusionauth.io/docs/security/tokens-and-keys/key-master.md): Learn how to create, import, and manage signing keys and certificates with Key Master.
- [Key Rotation](https://fusionauth.io/docs/security/tokens-and-keys/key-rotation.md): Learn about the keys and secrets FusionAuth uses, and how rotation differs for each one.
- [Signing Key Rotation](https://fusionauth.io/docs/security/tokens-and-keys/signing-key-rotation.md): Learn how to rotate the keys FusionAuth uses to sign JWTs, SAML responses, and webhook events.
- [Token Storage](https://fusionauth.io/docs/security/tokens-and-keys/token-storage.md): Learn how to secure tokens generated by FusionAuth.
