Expand description
Authentication subsystem (device-code flow only in v0.1).
AuthContext is the runtime entrypoint: every Graph call goes through
access_token(), which automatically refreshes when the cached token is
within 60 seconds of expiring.
§Lock discipline
The Mutex protects only in-memory configuration (cfg, cache_path,
http) and the refreshing guard flag. It is never held across file I/O
or network calls to avoid serializing all Graph requests behind a
potentially-stalled refresh.
§Single-flight refresh
When the cached token is stale, exactly one caller becomes the designated
refresher (refreshing = true). All other concurrent callers detect the
flag, release the lock, and wait on the shared Notify. When the refresh
completes (success or failure) the refresher wakes all waiters, which then
re-enter the loop and read the now-updated cache from disk.
Modules§
- device_
code - Device-code flow against
login.microsoftonline.com/<tenant>/oauth2/v2.0/. - token_
cache - On-disk token cache.