使用ADAL.net AcquireTokenAsync调用时出错 [英] Error while using ADAL.net AcquireTokenAsync call

查看:68
本文介绍了使用ADAL.net AcquireTokenAsync调用时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索Azure Active Directory。我正在尝试查看是否可以将自己的登录页面与自定义用户ID /密码控件一起使用,以捕获用户凭据并针对Azure AD进行验证。我正在使用ADAL.net来实现此目的,但是出现错误 parsing_wstrust_response_failed:解析WS-Trust响应失败。我在以下代码的最后一行收到此错误。

I am exploring Azure Active Directory. I am trying to see whether I can use my own login page with custom user id/password controls to capture the user credentials and validate against Azure AD. I am using ADAL.net to implement this, however I get an error "parsing_wstrust_response_failed: Parsing WS-Trust response failed". I get this error on the last line of the below code.

以下是我的代码:

string AppIdURL = ConfigurationManager.AppSettings["AppIdUrl"];
            UserCredential uc = new UserPasswordCredential("testuser@domain.com", "test123");
            AuthenticationContext aContext = new AuthenticationContext(System.Configuration.ConfigurationManager.AppSettings["AADInstance"]);
            AuthenticationResult result = aContext.AcquireTokenAsync(AppIdURL, ConfigurationManager.AppSettings["ClientId"], uc).Result;


推荐答案

请首先单击此处以查看约束和限制资源所有者密码凭证授予流程的Analysis。根据您的错误消息,用户是否与WS-Trust结盟?请提供有关您当前配置的更多信息,以帮助我们重现此错误。

Please first click here to view the constraints and limitations of the Resource Owner Password Credentials Grant flow . Base on your error message , is the user federated with WS-Trust ? Please provide more information about your current configuration to help us reproduce this error .

实际上,不建议使用资源所有者密码凭据授予流程。仅当资源所有者和客户端之间存在高度信任时(例如,客户端是设备操作系统或高度特权的应用程序的一部分),并且其他授权授予类型不可用时,才应使用此方法。作为授权代码。)

In fact, Resource Owner Password Credentials Grant flow is not recommend. This should only be used when there is a high degree of trust between the resource owner and the client (e.g., the client is part of the device operating system or a highly privileged application), and when other authorization grant types are not available (such as an authorization code).

如果您要自定义登录页面,例如在登录页面上添加公司品牌,则可以点击此处如何自定义登录页面。

If your aim is to customize the sign-in page ,such as add company branding to your sign-in page , you could click here for how to customize the sign-in page .

这篇关于使用ADAL.net AcquireTokenAsync调用时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆