Skip to content

Commit ca0877e

Browse files
committed
Mentions MSAL-Extensions
1 parent 4e2111c commit ca0877e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

msal/token_cache.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,14 @@ class SerializableTokenCache(TokenCache):
363363
364364
This class does NOT actually persist the cache on disk/db/etc..
365365
Depending on your need,
366-
the following simple recipe for file-based persistence may be sufficient::
366+
the following simple recipe for file-based, unencrypted persistence may be sufficient::
367367
368368
import os, atexit, msal
369369
cache_filename = os.path.join( # Persist cache into this file
370-
os.getenv("XDG_RUNTIME_DIR", ""), # Automatically wipe out the cache from Linux when user's ssh session ends. See also https://github.com/AzureAD/microsoft-authentication-library-for-python/issues/690
370+
os.getenv(
371+
# Automatically wipe out the cache from Linux when user's ssh session ends.
372+
# See also https://github.com/AzureAD/microsoft-authentication-library-for-python/issues/690
373+
"XDG_RUNTIME_DIR", ""),
371374
"my_cache.bin")
372375
cache = msal.SerializableTokenCache()
373376
if os.path.exists(cache_filename):
@@ -380,6 +383,10 @@ class SerializableTokenCache(TokenCache):
380383
app = msal.ClientApplication(..., token_cache=cache)
381384
...
382385
386+
Alternatively, you may use a more sophisticated cache persistence library,
387+
`MSAL Extensions <https://github.com/AzureAD/microsoft-authentication-extensions-for-python>`_,
388+
which provides token cache persistence with encryption, and more.
389+
383390
:var bool has_state_changed:
384391
Indicates whether the cache state in the memory has changed since last
385392
:func:`~serialize` or :func:`~deserialize` call.

0 commit comments

Comments
 (0)