@azure/identity-cache-persistence package

Funzioni

cachePersistencePlugin(unknown)

Plug-in che fornisce la memorizzazione nella cache dei token permanenti per @azure/identity credenziali. L'API del plug-in è compatibile con @azure/identity versioni 2.0.0 e successive. Caricare questo plug-in usando la funzione useIdentityPlugin, importata da @azure/identity.

Per abilitare questa funzionalità, è necessario passare anche tokenCachePersistenceOptions ai costruttori di credenziali con una proprietà enabled impostata su true.

Esempio:

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), "...");

Dettagli funzione

cachePersistencePlugin(unknown)

Plug-in che fornisce la memorizzazione nella cache dei token permanenti per @azure/identity credenziali. L'API del plug-in è compatibile con @azure/identity versioni 2.0.0 e successive. Caricare questo plug-in usando la funzione useIdentityPlugin, importata da @azure/identity.

Per abilitare questa funzionalità, è necessario passare anche tokenCachePersistenceOptions ai costruttori di credenziali con una proprietà enabled impostata su true.

Esempio:

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)

Parametri

context

unknown