> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.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-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=0eec1c741ea72a1663d36a3fb62c7d8b" 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-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=280&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=1b2b923144711b7508e0d4a1ef9e7117 280w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=560&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=e962ddfa1a25025d181f42f14c2684fd 560w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=840&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=eb8a6455fb641396c9e4b1499dfa3555 840w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=1100&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=75f6df39d6e7a3baeb65927576005f5c 1100w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=1650&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=836296f99cbe6be2a32756b0a5cecc65 1650w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/4qGX8tpXyo1pAaMc/docs/images/fr-ca/cdy7uua7fh8z/HQHhFWTtdfNa5TnZ1dwx6/76bce36d82d24a38eeb0ae617f34b36e/Existing_Creds_-_French.png?w=2500&fit=max&auto=format&n=4qGX8tpXyo1pAaMc&q=85&s=a5d8c18b867f5abac31a0ce2c5993254 2500w" />
           </Frame>

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

           <Frame>
             <img src="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=7ec8703999ee3dde6de45c9481b44f29" 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-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=280&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=dd09d573b1b5c6ff956ebfd27f64a779 280w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=560&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=0f58a29465a2714ee8b9066805b7d499 560w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=840&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=8b12cbacd9d68398cc49b390203a2147 840w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=1100&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=7cebe1547460ae27e207e3b4f898789b 1100w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=1650&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=299d848d75abb45450ff4535576ea2bd 1650w, https://mintcdn.com/docs-dev-docs-event-stream-action-templates/1giWs3MwX5Akld9c/docs/images/fr-ca/cdy7uua7fh8z/7JfsCBwytWO6Q7hUvdtSwJ/45b2bd194982fc08c87ecae761cfd340/New_Creds_-_French.png?w=2500&fit=max&auto=format&n=1giWs3MwX5Akld9c&q=85&s=0064e6c89cdf2c23337dc22b712d4b21 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)
