@azure/identity-cache-persistence package

Functions

cachePersistencePlugin(unknown)

Plug-in qui fournit la mise en cache des jetons persistants pour @azure/identity informations d’identification. L’API de plug-in est compatible avec @azure/identity versions 2.0.0 et ultérieures. Chargez ce plug-in à l’aide de la fonction useIdentityPlugin, importée à partir de @azure/identity.

Pour activer cette fonctionnalité, vous devez également passer tokenCachePersistenceOptions à vos constructeurs d’informations d’identification avec une propriété enabled définie sur true.

Exemple:

import { DeviceCodeCredential } from "@azure/identity";

const credential = new DeviceCodeCredential({
  tokenCachePersistenceOptions: {
    enabled: true,
  },
});

// We'll use the Microsoft Graph scope as an example
const scope = "https://graph.microsoft.com/.default";

// Print out part of the access token
console.log((await credential.getToken(scope)).token.substring(0, 10), "...");

Informations relatives à la fonction

cachePersistencePlugin(unknown)

Plug-in qui fournit la mise en cache des jetons persistants pour @azure/identity informations d’identification. L’API de plug-in est compatible avec @azure/identity versions 2.0.0 et ultérieures. Chargez ce plug-in à l’aide de la fonction useIdentityPlugin, importée à partir de @azure/identity.

Pour activer cette fonctionnalité, vous devez également passer tokenCachePersistenceOptions à vos constructeurs d’informations d’identification avec une propriété enabled définie sur true.

Exemple:

import { DeviceCodeCredential } from "@azure/identity";

const credential = new DeviceCodeCredential({
  tokenCachePersistenceOptions: {
    enabled: true,
  },
});

// We'll use the Microsoft Graph scope as an example
const scope = "https://graph.microsoft.com/.default";

// Print out part of the access token
console.log((await credential.getToken(scope)).token.substring(0, 10), "...");
function cachePersistencePlugin(context: unknown)

Paramètres

context

unknown