title: Azure Active Directory logout (clear persistent token)
body: <p>I am developing a Windows Store application that communicate to Dynamics CRM Online using Azure Active Directory for the authentication.</p>
  
  <p>The application uses this CRM 2013 SDK example: <code>SampleCode\CS\ModernAndMobileApps\ModernSoapApp</code></p>
  
  <p>and refers to this nuget package for the authentication:</p>
  
  <p><a href="https://www.nuget.org/packages/Microsoft.Preview.WindowsAzure.ActiveDirectory.Authentication" rel="noreferrer">Microsoft.Preview.WindowsAzure.ActiveDirectory.Authentication</a></p>
  
  <p>I am able to authenticate correctly, the main line is this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>AuthenticationResult result = await _authenticationContext.AcquireTokenAsync("Microsoft.CRM", ClientID, redirectUrl, string.Empty, string.Empty);
  </code></pre>
  
  <p>The problem is that I need to add a logout functionality and I can't get rid of the persistent token.</p>
  
  <p>I tried to do a logout with the following line:</p>
  
  <pre class="lang-cs prettyprint-override"><code>(AuthenticationContext.TokenCache as DefaultTokenCache).Clear();
  </code></pre>
  
  <p>but the application is able to get a valid token by itself when I call again the AcquireTokenAsync method instead showing the page for entering the credentials.</p>
  
  <p>What am I missing to perform a full logout?</p>