> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-chore-myaccount-api-autoupdate.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Découvrez comment configurer les requêtes d’autorisation sécurisées par JWT (JAR) pour une application.

# Configurer les requêtes d’autorisation sécurisées par JWT (JAR)

export const AuthCodeBlock = ({filename, icon, language, highlight, children}) => {
  const [displayText, setDisplayText] = useState(children);
  const [copyText, setCopyText] = useState(children);
  const wrapperRef = React.useRef(null);
  useEffect(() => {
    let unsubscribe = null;
    function init() {
      if (!window.autorun || !window.rootStore) {
        return;
      }
      unsubscribe = window.autorun(() => {
        let processedChildrenForDisplay = children;
        let processedChildrenForCopy = children;
        for (const [key, value] of window.rootStore.variableStore.values.entries()) {
          const escapedKey = key.replaceAll(/[.*+?^${}()|[\]\\]/g, (String.raw)`\$&`);
          let displayValue = value;
          if (key === "{yourClientSecret}" && value !== "{yourClientSecret}") {
            displayValue = value.substring(0, 3) + "*****MASQUÉ*****";
          }
          processedChildrenForDisplay = processedChildrenForDisplay.replaceAll(new RegExp(escapedKey, "g"), displayValue);
          processedChildrenForCopy = processedChildrenForCopy.replaceAll(new RegExp(escapedKey, "g"), value);
        }
        setDisplayText(processedChildrenForDisplay);
        setCopyText(processedChildrenForCopy);
      });
    }
    if (window.rootStore) {
      init();
    } else {
      window.addEventListener("adu:storeReady", init);
    }
    return () => {
      window.removeEventListener("adu:storeReady", init);
      unsubscribe?.();
    };
  }, [children]);
  useEffect(() => {
    if (!wrapperRef.current) return;
    const originalWriteText = navigator.clipboard.writeText.bind(navigator.clipboard);
    let isOverriding = false;
    const handleClick = e => {
      const button = e.target.closest('[data-testid="copy-code-button"]');
      if (!button || !wrapperRef.current.contains(button)) return;
      isOverriding = true;
      navigator.clipboard.writeText = text => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
          return originalWriteText(copyText);
        }
        return originalWriteText(text);
      };
      setTimeout(() => {
        if (isOverriding) {
          isOverriding = false;
          navigator.clipboard.writeText = originalWriteText;
        }
      }, 100);
    };
    const wrapper = wrapperRef.current;
    wrapper.addEventListener('click', handleClick, true);
    return () => {
      wrapper.removeEventListener('click', handleClick, true);
      if (navigator.clipboard.writeText !== originalWriteText) {
        navigator.clipboard.writeText = originalWriteText;
      }
    };
  }, [copyText]);
  return <div ref={wrapperRef}>
      <CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
        {displayText}
      </CodeBlock>
    </div>;
};

export const codeExample1 = `POST https://{yourTenant}.auth0.com/api/v2/clients/{yourClientId}/credentials
  Authorization: Bearer <YOUR_ACCESS_TOKEN>
  Content-Type: application/json
  {
    "name": "Mes informations d’identification pour JAR",
    "credential_type": "public_key",
    "pem": "[YOUR PEM FILE CONTENT]",
    "alg": "RS256"
  }`;

export const codeExample2 = `PATCH https://{yourTenant}.auth0.com/api/v2/clients/{yourClientId}
Authorization: Bearer <YOUR_ACCESS_TOKEN>
Content-Type: application/json
{
  "signed_request_object": {
    "credentials": [{"id": "[YOUR CREDENTIAL ID]"}]
  }
}`;

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  Pour utiliser les fonctionnalités de Highly Regulated Identity, vous devez avoir un Enterprise Plan avec le module complémentaire Highly Regulated Identity. Consultez la [tarification Auth0](https://auth0.com/pricing/) pour en savoir plus.
</Callout>

<Tooltip tip="JSON Web Token (JWT) : format standard d’ID Token (et souvent d’Access Token) utilisé pour représenter des claims de façon sécurisée entre deux parties." cta="Voir le glossaire" href="/docs/fr-ca/glossary?term=JWT">JWT</Tooltip>-Les requêtes d’autorisation sécurisées par JWT (JAR) permettent de regrouper les paramètres de requête d’autorisation OAuth2 dans un seul paramètre de requête JWT, qui est ensuite signé pour en protéger l’intégrité.

<h2 id="prerequisites">
  Prérequis
</h2>

Avant de configurer votre application pour utiliser JAR, vous devez [générer une paire de clés RSA](/docs/fr-ca/secure/application-credentials/generate-rsa-key-pair).

<Warning>
  Vous devriez générer une paire de clés distincte pour chaque type d’utilisation des informations d’identification. Par exemple, n’utilisez pas la même paire de clés à la fois pour JAR et pour l’authentification Private Key JWT.
</Warning>

<h2 id="configure-jar-for-an-application">
  Configurer JAR pour une application
</h2>

Vous pouvez configurer JAR pour une application avec l’<Tooltip tip="Auth0 Dashboard : l’interface principale d’Auth0 pour configurer vos services." cta="Voir le glossaire" href="/docs/fr-ca/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> et l’<Tooltip tip="Auth0 Dashboard : l’interface principale d’Auth0 pour configurer vos services." cta="Voir le glossaire" href="/docs/fr-ca/glossary?term=Management+API">Management API</Tooltip>.

<Tabs>
  <Tab title="Auth0 Dashboard">
    Utilisez l’Auth0 Dashboard pour configurer votre application afin qu’elle utilise JAR avec des clés RSA générées au préalable.

    1. Accédez à [Auth0 Dashboard > Applications](https://manage.auth0.com/#/applications).
    2. Sélectionnez l’application que vous souhaitez utiliser avec JAR.
    3. Sélectionnez l’onglet **Application Settings**.
    4. Dans la section **Authorization Requests**, activez **Require JWT-Secured Authorization Requests**.
    5. Si aucune information d’identification n’est attribuée et que des informations d’identification sont disponibles, vous serez invité à attribuer une information d’identification existante.

           <Frame>
             <img src="https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=eb2a896e6e6da83924b1232fe92edb5d" alt="Dashboard > Application > Settings > Assign Existing Credentials" data-og-width="792" width="792" data-og-height="688" height="688" data-path="docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=280&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=41617fe9de348adff1b4f8163b45bf82 280w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=560&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=b3e1b8c3dccb69f2add926860a850104 560w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=840&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=b58398c76ab0b79c69f5fff0d226a247 840w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=1100&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=ed11f697e11c6a7b364b1c0c3b64f7ad 1100w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=1650&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=6e2b3d9a1394e9d108c62e86fd433d52 1650w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/e47068cc9e85c538f80476162f4314a3/Existing_Creds_-_English.png?w=2500&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=b4e65aed0d838dce2d28441d476ef274 2500w" />
           </Frame>
    6. Vous aurez aussi l’option d’attribuer une nouvelle information d’identification.

           <Frame>
             <img src="https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=8b62eac23e5493a29346ff82c4e78707" alt="Auth0 Dashboard > Applications > Settings > Assign New Credentials" data-og-width="702" width="702" data-og-height="366" height="366" data-path="docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=280&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=8b6e5308696b9c8ae9395821f5124217 280w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=560&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=aea6b280f7e128d902a0bb3580eb6f5f 560w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=840&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=c44bd60e0792b852e6ac8c341d43a105 840w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=1100&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=312c6d40b37209147dcc77eb987698df 1100w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=1650&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=cb5d14fc5be9eda82a10d59aa449191b 1650w, https://mintcdn.com/docs-dev-chore-myaccount-api-autoupdate/0pc0J-xi5wIlMd5V/docs/images/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/b85fd39fea7330a31496f51347767ae7/New_Creds_-_EN.png?w=2500&fit=max&auto=format&n=0pc0J-xi5wIlMd5V&q=85&s=b3c0dd4c51a480c10e41b2b32b404fec 2500w" />
           </Frame>
    7. Ajoutez et attribuez une nouvelle information d’identification en téléversant une paire de clés RSA générée au préalable. Lorsque vous y êtes invité, entrez les renseignements suivants :

       * **Name** : un nom pour identifier l’information d’identification
       * **Public Key** : la clé publique du certificat X.509 au format PEM
       * **Algorithm** : sélectionnez l’algorithme de signature JAR
       * **Expiration Date** : définissez la date d’expiration de l’information d’identification
  </Tab>

  <Tab title="Management API">
    Utilisez la [Management API](https://auth0.com/docs/api/management/v2) pour configurer JAR pour votre application à l’aide de la propriété de configuration client `signed_request_object`. Cette propriété d’objet contient les champs suivants :

    * `required` : force toutes les requête d’autorisation vers `/authorize` et `/oauth/par` à utiliser JAR. Pour en savoir plus, consultez [flux de code d’autorisation with JWT-Secured Authorization Requests](/docs/fr-ca/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar).
    * `credentials` : un tableau d’ID d’informations d’identification utilisées pour vérifier les signatures.

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      Le paramètre credentials se comporte de façon semblable au paramètre Private Key JWT `client_authentication_methods.private_key_jwt.credentials`, qui prend en charge la création d’informations d’identification lorsque vous créez une nouvelle application. Pour en savoir plus, consultez [Configure Private Key JWT](/docs/fr-ca/get-started/applications/configure-private-key-jwt).
    </Callout>

    Vous pouvez configurer JAR pour une nouvelle application ou une application existante au moyen de la Management API.

    <h4 id="configure-jar-for-a-new-application">
      Configurer JAR pour une nouvelle application
    </h4>

    Lorsque vous créez une nouvelle application, configurez JAR en envoyant une requête POST avec `signed_request_object`. Dans cette requête POST, vous pouvez aussi enregistrer l’information d’identification client correspondante (c.-à-d. la clé PEM) :

    ```json lines theme={null}
    POST https://{yourTenant}.auth0.com/api/v2/clients
    Authorization: Bearer <YOUR_ACCESS_TOKEN>
    Content-Type: application/json
    {
      "name": "My App using JAR",
      "signed_request_object": {
          "required": true,
    "credentials": [{
            "name": "My credential for JAR",
            "credential_type": "public_key",
            "pem": "[YOUR PEM FILE CONTENT]",
            "alg": "RS256"
    }]
      },
      "jwt_configuration": {
        "alg": "RS256"
      }
    }
    ```

    <h4 id="configure-jar-for-an-existing-application">
      Configurer JAR pour une application existante
    </h4>

    Lorsque vous mettez à jour une application existante, vous devez d’abord créer explicitement une information d’identification client. La requête POST suivante utilise le contenu de votre fichier PEM pour créer vos informations d’identification client pour JAR :

    <AuthCodeBlock children={codeExample1} language="json" />

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      Assurez-vous que les sauts de ligne sont correctement encodés en JSON, sans mise en forme supplémentaire.
    </Callout>

    Ensuite, attribuez l’information d’identification client à la configuration client `signed_request_object`. La requête PATCH suivante associe vos informations d’identification client à `signed_request_object` :

    <AuthCodeBlock children={codeExample2} language="json" />
  </Tab>
</Tabs>

<h2 id="learn-more">
  En savoir plus
</h2>

* [Flux du code d’autorisation avec requêtes d’autorisation sécurisées par JWT (JAR)](/docs/fr-ca/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar)
