简体   繁体   中英

Windows Forms or WPF Desktop App logging in to azure AD with MFA to access web api

i am wondering how this works, let assume i have the following setup:

  • Azure API App (or any other web api) protected by Azure Active AD Provider
  • User that has MFA enabled
  • Desktop App (winforms or wpf) that needs to use the web api

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 eg visual studio does when i am logging in to azure from VS). I know there SDK from Microsoft to do this ( https://msdn.microsoft.com/en-us/library/azure/dn249464.aspx ) 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.

Thank you for your answer in advance :) best Laurin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM