title: Windows Forms or WPF Desktop App logging in to azure AD with MFA to access web api
body: <p>i am wondering how this works, let assume i have the following setup:</p>
  
  <ul>
  <li>Azure API App (or any other web api) protected by Azure Active AD Provider</li>
  <li>User that has MFA enabled</li>
  <li>Desktop App (winforms or wpf) that needs to use the web api</li>
  </ul>
  
  <p>So in order to use the web api the desktop app needs to authenticate the user against azure AD to get a access token. Since MFA is enabled i need to open up a browser window and to do so (this is at least what e.g. visual studio does when i am logging in to azure from VS).
  I know there SDK from Microsoft to do this (<a href="https://msdn.microsoft.com/en-us/library/azure/dn249464.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/azure/dn249464.aspx</a>) but i am wondering how this generally works, since there are other providers and services they offer me a REST Service for which i need a token to access. And all the scenarios are always explained in web apps and then it just redirects back and i have my access token in a cookie.
  but in a desktop app this won't work. so i need a way to show up a browser window and get the auth token out from it.
  you know what i mean? what is the best practice to do so? How does this work?
  did anybody implement something like this? not every provider offers beautiful .net sdk as microsoft does that handles all this stuff for me.</p>
  
  <p>Thank you for your answer in advance :)
  best
  Laurin</p>