@azure/identity-cache-persistence package

Funkcje

cachePersistencePlugin(unknown)

Wtyczka, która zapewnia trwałe buforowanie tokenów dla @azure/identity poświadczeń. Interfejs API wtyczki jest zgodny z @azure/identity w wersji 2.0.0 lub nowszej. Załaduj tę wtyczkę przy użyciu funkcji useIdentityPlugin zaimportowanej z @azure/identity.

Aby włączyć tę funkcję, należy również przekazać tokenCachePersistenceOptions do konstruktorów poświadczeń z właściwością enabled ustawioną na true.

Przykład:

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

Szczegóły funkcji

cachePersistencePlugin(unknown)

Wtyczka, która zapewnia trwałe buforowanie tokenów dla @azure/identity poświadczeń. Interfejs API wtyczki jest zgodny z @azure/identity w wersji 2.0.0 lub nowszej. Załaduj tę wtyczkę przy użyciu funkcji useIdentityPlugin zaimportowanej z @azure/identity.

Aby włączyć tę funkcję, należy również przekazać tokenCachePersistenceOptions do konstruktorów poświadczeń z właściwością enabled ustawioną na true.

Przykład:

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)

Parametry

context

unknown