简体   繁体   English

Azure AD 访问令牌不包含组声明

[英]Azure AD access token does not contain groups claim

I'm using curl command to get access token, i'm able to get access token using curl command with client credentials.我正在使用 curl 命令获取访问令牌,我可以使用带有客户端凭据的 curl 命令获取访问令牌。

curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=client_credentials&client_id={client_id}&client_secret={secret}' https://login.microsoftonline.com/{tentant_id}/oauth2/v2.0/token

But the Access token does not contain group claims.但访问令牌不包含组声明。

How to get groups in the access token..?如何在访问令牌中获取组..? any help is appreciated任何帮助表示赞赏

在此处输入图像描述

在此处输入图像描述

You may refer to this document你可以参考这个文件

If you are exposing a Web API using the Expose an API option, then you can also choose the Group ID option under the Access section.如果您要使用 Expose an API 选项公开 Web API,那么您还可以在 Access 部分下选择 Group ID 选项。

So, when you add groups claims in Token configuration blade, you need to pick "group id" in "Access"因此,当您在Token configuration刀片中添加组声明时,您需要在“访问”中选择“组 ID”

在此处输入图像描述

And you also need to check the manifest file of the azure ad app in azure portal, if the groupMembershipClaims claim has null vaule, you may set it to All ,see this section .您还需要在 azure 门户中检查 azure 广告应用程序的清单文件,如果groupMembershipClaims声明具有All值,请参阅此部分

If you need to add groups for your azure ad app, go to azure ad -> Enterprise Applications -> find your app -> users and groups如果您需要为您的 azure 广告应用程序添加组,go 到 azure 广告 -> 企业应用程序 -> 找到您的应用程序 -> 用户和组

在此处输入图像描述

Then you need to "expose an api", follow this document , then you need to add the api permission in your azure ad application which used to generate access token.然后你需要“公开一个 api”,按照这个文档,然后你需要在你的 azure 广告应用程序中添加 api 权限,用于生成访问令牌。

The screenshot below is an access token generated by ropc flow.下面的截图是 ropc flow 生成的访问令牌。 But actually, I test with client credential flow, I can't get groups claim.但实际上,我使用客户凭证流进行测试,我无法获得groups声明。 In my opinion, this is because client credential flow is not related to a user, even user groups.在我看来,这是因为客户端凭证流与用户无关,甚至与用户组无关。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure AD访问令牌appid声明值 - Azure AD access token appid claim value 无法在 Azure AD 的 access_token 中获得 email 声明 - Can't get email claim in access_token in Azure AD Azure AD B2C:: 访问令牌中缺少角色声明 - Azure AD B2C :: Roles claim is missing in access token 来自 Azure AD 联合的 ID 令牌不包含“角色”声明 - ID token from Azure AD federation does not contains “roles” claim Azure AD - 令牌中缺少角色声明 - Azure AD - missing roles claim in the token 如何在令牌请求时向Azure AD访问令牌(JWT)添加自定义声明? - How add custom claim to Azure AD access token (JWT) at token request time? Azure OAuth2 代码流,组声明不在访问令牌中,而是在 id 令牌中 - Azure OAuth2 Code Flow, groups claim is not in access token, but in id token 如何使用 Azure AD 访问和过滤 JWT 令牌中的组? - How to access and filter groups in JWT token using Azure AD? 在使用 Azure AD 客户端凭据流生成的访问令牌中的 UPN 声明中添加自定义值 - Add Custom value in UPN claim in Access Token generated using Azure AD Client Credential Flow 当 scope 不是 Azure AD 中的图形 API 时,如何添加自定义声明并检索其作为 access_token 的一部分? - How to add a custom claim and retrieve the same as part of access_token, when the scope is not Graph API in Azure AD?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM