-
Notifications
You must be signed in to change notification settings - Fork 214
Interactive authentication in .net core 2.0 console application on windows #885
Comments
.NET Core does not provide UI (contrary to .NET Framework 4.5, UWP etc ...). Therefore any interactive flow is not supported. the reason is that Azure AD returns directly some HTML to be presented in a Web browser, and .NET Core does not provide any. |
I see. Thanks for clarifying |
Hi, I am having the same issue. Is there an alternative way? |
Yes. We strongly advise that you use MSAL.NET, which does support interactive flow with .NET Core. See https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-desktop-acquire-token |
Sorry I was a bit carried away. So my is a web app(aspnetcore) and not a desktop app and I get the above when I use with ConfidentialClientApplication. So from your link I found the below. https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-web-api-call-api-call-api But it does not have a code for the interactive one. How would you implement interactive token aquisition in a aspnetcore application? When I use the below code it complains it is not possible in aspnetcore. |
If this is a Web app, that's the link you need to use, @liroforum In a nutshell, in a Web App, the sign-in part is done by ASP.NET Core. The token acquisition by MSAL. We also have an incremental tutorial https://github.com/Azure-Samples/ms-identity-aspnetcore-webapp-tutorial |
I'm trying to prompt a user for credentials in a net core 2.0 console application running on windows but didn't find any ressources that show me how to do it properly.
This is what I tried:
var authority = "https://login.microsoftonline.com/<mytenantname>";
var ctx = new AuthenticationContext(authority);
var appId = "<myappid>";
var resourceId = "https://graph.microsoft.com";
await ctx.AcquireTokenAsync(resourceId, appId, new Uri("http://localhost"), new PlatformParameters());
However I get a NotImplemented exception.
Is this scenario supported?
The text was updated successfully, but these errors were encountered: