title: How to setup Active Directory authentication with Vue.js and a .NET Core API
body: <p>I am re-writing one of our intranet sites as a .NET Core 3.1 WebAPI backend with a Vue.js frontend.  I'm an experienced programmer, but new to some of these technologies.  I need to setup authentication with Active Directory so local network users don't have to login to the site.</p>
  <p>I've seen some things about using tokens and sending that in the API requests, but don't know where to start.  Eventually, there will be a second Vue.js frontend for external (third-party) users who will need to authenticate with a username/password form.  So the API needs to be able to handle both kinds of users.</p>
  <p>How do I set this up? Any instructions or guidance is appreciated. I'm sure I'll have other questions as I get into it.
  Thanks!</p>
  <p><strong>EDIT</strong></p>
  <p>I was able to get this method working to take a username/password and validate it against our Active Directory domain (requires the <code>Microsoft.Windows.Compaibility</code> package)</p>
  <pre><code>using System.DirectoryServices.AccountManagement;
  private bool IsValidUserAndPasswordCombination(string username, string password)
      {
          bool isValid = false;
          using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, &quot;localdomainname.com&quot;))
          {
              isValid = pc.ValidateCredentials(username, password);
          }
          return isValid;
      }
  </code></pre>
  <p>Now I just need to know the best way to pass the current Windows user credentials to the API.  The API is setup for anonymous authentication.  Is there a way to get the credentials in Vue.js and pass them without using the authorization headers?</p>