我正在尝试使用ADAL ( Active directory认证库)在WPF应用程序中验证我的用户。
我使用了以下代码:
AuthenticationContext context = new AuthenticationContext("https://login.windows.net/<my_tenant>.onmicrosoft.com");
AuthenticationResult result = await context.AcquireTokenAsync("https://graph.windows.net/", "<client_id>",new Uri("<redirect_uri>");AcquireTokenAsync方法需要第三个参数:重定向uri。
我了解在web应用程序中使用此参数的用法。
但在WPF的情况下,我不理解设置什么/如何使用它。
有什么想法吗?
发布于 2016-07-20 14:43:58
我们可以将其设置为localhost,以便身份验证端点可以将身份验证码重定向到客户端。并且它将使用认证码来请求令牌。
这里有一个示例供您参考:
AuthenticationContext context = new AuthenticationContext("https://login.microsoftonline.com/yourTenant/");
AuthenticationResult result = await context.AcquireTokenAsync("https://graph.windows.net/", "{clientId}", new Uri("http://localhost"), new PlatformParameters(PromptBehavior.Auto));https://stackoverflow.com/questions/38461916
复制相似问题