> ## Documentation Index
> Fetch the complete documentation index at: https://docs-staging-fix-docs-5525.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configurer les demandes d’autorisation sécurisées par JWT (JAR)

> Découvrez comment configurer des demandes d’autorisation sécurisées par JWT (JAR) pour une application.

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) + "*****MASKED*****";
          }
          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": "My credentials for 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 l’identité très réglementée (HRI), vous devez disposer d’un plan Enterprise avec le module complémentaire Identité très réglementée. Consultez [Tarification Auth0](https://auth0.com/pricing/) pour plus de détails.
</Callout>

Les demandes d’autorisation sécurisées par <Tooltip href="/docs/fr-ca/glossary?term=json-web-token" tip="Jeton Web JSON (JWT)
Format standard de jeton d’ID (et souvent de jeton d’accès) utilisé pour représenter en toute sécurité des demandes entre deux parties." cta="Voir le glossaire">JWT</Tooltip> (JAR) permettent de regrouper les paramètres de requête d’autorisation OAuth2 en un seul paramètre de requête JWT, qui est ensuite signé pour protéger l’intégrité.

## Prérequis

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 devez générer une paire de clés distincte pour chaque type d’utilisation des identifiants. Par exemple, ne réutilisez pas les mêmes paires de clés pour l’authentification JAR et l’authentification par clé privée JWT.
</Warning>

## Configurer JAR pour une application

Vous pouvez configurer JAR pour une application avec <Tooltip href="/docs/fr-ca/glossary?term=auth0-dashboard" tip="Auth0 Dashboard
Principal produit d’Auth0 pour configurer vos services." cta="Voir le glossaire">Auth0 Dashboard</Tooltip> et <Tooltip href="/docs/fr-ca/glossary?term=management-api" tip="Management API
Un produit permettant aux clients d’effectuer des tâches administratives." cta="Voir le glossaire">Management API</Tooltip>.

<Tabs>
  <Tab title="Auth0 Dashboard">
    Utilisez Auth0 Dashboard pour configurer votre application afin qu’elle utilise JAR avec les clés RSA déjà générées.

    1. Naviguez jusqu’à [Auth0 Dashboard > Applications](https://manage.auth0.com/#/applications).

    2. Sélectionnez l’application à utiliser avec JAR.

    3. Sélectionnez l’onglet **Application Settings (Paramètres d’application)**.

    4. Dans la section **Authorization Requests (Demandes d’autorisation)**, activez **Require JWT-Secured Authorization (Exiger l’autorisation sécurisée par JWT)**.

    5. Si aucun identifiant n’est attribué et que des identifiants sont disponib]\(/docs/images/serez invité à attribuer un identifiant existant.

           <Frame>
             <img src="https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=f4b1e77ab4009ecbb3601c2fe6a894e5" alt="Dashboard > Application > Settings > Assign Existing Credentials" data-og-width="792" width="792" data-og-height="688" height="688" data-path="docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=280&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=8cb5962eaa2e9d3ee810ab817082cf16 280w, https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=560&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=e43d3a7fc30cb18d612304362b2801c8 560w, https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=840&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=8f3b7539a33fb786b3713abdf1ea0663 840w, https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=1100&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=af958b2bb050e0eb3637486f95a2e1e0 1100w, https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=1650&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=a07e4c95691b95214895249f3c578d01 1650w, https://mintcdn.com/docs-staging-fix-docs-5525/69KhcSvwxWHWcXDu/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=2500&fit=max&auto=format&n=69KhcSvwxWHWcXDu&q=85&s=a3af900431025a03202315341e2d4139 2500w" />
           </Frame>

    6. Vous aurez également la possibilité d’attribuer un nouvel identiifant.

           <Frame>
             <img src="https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=61c5262d45f15e5c2aedc6cfe5e6df91" alt="Auth0 Dashboard > Applications > Settings > Assign New Credentials" data-og-width="702" width="702" data-og-height="367" height="367" data-path="docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=280&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=c36af419f7438c9a19234312a4cd8b0a 280w, https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=560&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=c63b3fbac7f6bd249e860c421a8e4fb5 560w, https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=840&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=93ee52e8026f5665f445a632099d8531 840w, https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=1100&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=5a409d0adcba694db08f845234f6a0f3 1100w, https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=1650&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=f4eae64675e719d9abe41479862b31a2 1650w, https://mintcdn.com/docs-staging-fix-docs-5525/Y7OYUKlxWt60f7Rj/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=2500&fit=max&auto=format&n=Y7OYUKlxWt60f7Rj&q=85&s=241b28b8e0ce8691a496926f094d6500 2500w" />
           </Frame>

    7. Ajoutez et attribuez un nouvel identifiant en téléversant une paire de clés RSA déjà générées. Lorsque vous y êtes invité, entrez ce qui suit :

       * Nom\*\*: nom permettant d’identifier l’identifiant\*\*
       * **Clé publique** : clé publique du certificat X.509 en format PEM
       * **Algorithme** : sélection de l’algorithme de signature JAR
       * **Date d’expiration** : définition de la date d’expiration de l’identifiant
  </Tab>

  <Tab title="Management API">
    Utilisez [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` (obligatoire) : oblige toutes les demandes d’autorisation vers `/authorize` et `/oauth/par` à utiliser JAR. Pour en savoir plus, lisez les articles [Flux de code d’autorisation avec les demandes d’autorisation sécurisée par JWT](/docs/fr-ca/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-jar) et [Flux de code d’autorisation avec PAR et JAR](/docs/fr-ca/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-par-and-jar).
    * `credentials` (identifiants) : une série d’identifiants utilisés pour vérifier les signatures.

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      Le paramètre des informations d’identification se comporte de la même manière que le paramètre de la clé privée JWT `client_authentication_methods.private_key_jwt.credentials` qui prend en charge la création d’informations d’identification lors de la création d’une nouvelle application. Pour en savoir plus, lisez [Configurer la clé privée JWT](/docs/fr-ca/get-started/applications/configure-private-key-jwt).
    </Callout>

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

    #### Configurer JAR pour une nouvelle application

    Lorsque vous créez une nouvelle application, configurez JAR en envoyant une demande POST contenant `signed_request_object`. Dans cette demande, vous pouvez aussi enregistrer l’identifiant client correspondant (par exemple 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"
      }
    }
    ```

    #### Configurer JAR pour une application existante

    Lors de la mise à jour d’une application existante, vous devez d’abord créer un identifiant client de manière explicite. La demande POST suivante utilise le contenu de votre fichier PEM pour créer vos identifiants client pour JAR :

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

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      Assurez-vous que les nouvelles lignes sont correctement codées en JSON sans formatage supplémentaire.
    </Callout>

    Attribuez ensuite les identifiants client à la configuration client `signed_request_object`. La demande PATCH suivante associe les identifiants client à `signed_request_object` :

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

## En savoir plus

* [Flux de code d’autorisation avec les demandes 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)
* [Flux de code d’autorisation avec PAR et JAR](/docs/fr-ca/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-par-and-jar)
