@azure/identity-cache-persistence package

Funções

cachePersistencePlugin(unknown)

Um plug-in que fornece cache de token persistente para credenciais de @azure/identity. A API do plug-in é compatível com @azure/identity versões 2.0.0 e posteriores. Carregue esse plug-in usando a função useIdentityPlugin, importada de @azure/identity.

Para habilitar essa funcionalidade, você também deve passar tokenCachePersistenceOptions para seus construtores de credenciais com uma propriedade enabled definida como true.

Exemplo:

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

Detalhes da função

cachePersistencePlugin(unknown)

Um plug-in que fornece cache de token persistente para credenciais de @azure/identity. A API do plug-in é compatível com @azure/identity versões 2.0.0 e posteriores. Carregue esse plug-in usando a função useIdentityPlugin, importada de @azure/identity.

Para habilitar essa funcionalidade, você também deve passar tokenCachePersistenceOptions para seus construtores de credenciais com uma propriedade enabled definida como true.

Exemplo:

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)

Parâmetros

context

unknown