我试图用下面的代码为用户生成一个令牌。
string apiResourceId = "11224320-66b9-4132-8953-9aa485f07004";
string clientId = "bc9869a0-2393-4e42-8c52-845071640ea8";
Uri redirectUri = new Uri("https://localhost:44335/");
string authority = string.Format("https://login.windows.net/{0}",
"rudderless.onmicrosoft.com");
var authContext = new AuthenticationContext(authority);
AuthenticationResult authenticationResult;
authenticationResult = await authContext.AcquireTokenAsync(apiResourceId, clientId,
redirectUri, new PlatformParameters(PromptBehavior.Auto, null));我在AcquireTokenAsync的电话里遇到了一个错误-
AADSTS70002:请求主体必须包含以下参数:'client_secret或client_assertion‘。跟踪ID: a198696d-8377-40 09 8351-527a25183500相关ID: 24d4b47d-67bf-46c0-a6b7-a248c434512e时间戳: 2017-09-20 23:38 z
如果我想要生成一个令牌,那么当一个用户通过AAD进行身份验证时,我为什么需要一个client_secret或client_assertion?我使用的客户端类型是"Web /API“。然而,当我试图使用本机客户端时,我得到了生成的令牌,但是对apResourceID的API调用会产生未经授权的错误。
我要问的几个问题都是关于剪报的-
发布于 2017-09-21 00:11:07
Web和API被认为是机密客户端。有关这里 2规范中不同客户端类型的定义,请参见OAuth 2。这些类型的客户端总是需要使用它们的客户端秘密进行身份验证,而不管它们遵循的流程是什么。
Confidential clients are typically issued (or establish) a set of
client credentials used for authenticating with the authorization
server (e.g., password, public/private key pair).本机客户端应用程序是公共客户端的子集。这些在规范中被定义为:
Clients incapable of maintaining the confidentiality of their
credentials (e.g., clients executing on the device used by the
resource owner, such as an installed native application or a web
browser-based application), and incapable of secure client
authentication via any other means.因此,它们不需要或不需要client_secret来验证.但这也意味着它们只能使用用户上下文进行身份验证,而机密客户端可以在没有用户在场(客户凭证流)的情况下进行身份验证。
这是很难回答的,不知道更多的错误和你正在打的电话,造成这个错误。您应该提供有关此场景的更多信息。
是。在新的Azure Active Directory V2端点中,我们有一个"行政同意终结点“。
使用旧的V1端点,我们有一个&prompt=admin_consent查询字符串,您可以阅读有关这里的内容。
https://stackoverflow.com/questions/46333225
复制相似问题