I use this code sample :https://github.com/Azure-Samples/active-directory-dotnet-graphapi-web , i know this code sample is using client library , but if i want to perfrom a query (use httpclient) directly use api calls ,i used below code to get the access token from cache :
string userObjectID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
AuthenticationContext authContext = new AuthenticationContext(Startup.Authority, new NaiveSessionCache(userObjectID));
ClientCredential credential = new ClientCredential(clientId, appKey);
var result = await authContext.AcquireTokenSilentAsync(resource, credential, new UserIdentifier(userObjectID, UserIdentifierType.UniqueId));
But i found always threw error :Failed to acquire token silently as no token was found in the cache. Call method AcquireToken