@azure/identity-cache-persistence package
Funciones
| cache |
Complemento que proporciona almacenamiento en caché de tokens persistente para Para habilitar esta funcionalidad, también debe pasar Ejemplo:
|
Detalles de la función
cachePersistencePlugin(unknown)
Complemento que proporciona almacenamiento en caché de tokens persistente para @azure/identity credenciales. La API del complemento es compatible con @azure/identity versiones 2.0.0 y posteriores. Cargue este complemento mediante la función useIdentityPlugin, importada desde @azure/identity.
Para habilitar esta funcionalidad, también debe pasar tokenCachePersistenceOptions a los constructores de credenciales con una propiedad enabled establecida en true.
Ejemplo:
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