我已委派用户权限 User.ReadBasic.All
。在documentation , 它说明了这一点
"Allows the app to read a basic set of profile properties of other users in your organization on behalf of the signed-in user. This includes display name, first and last name, email address, open extensions and photo. Also allows the app to read the full profile of the signed-in user."
如何让所有用户都拥有基本配置文件?
var accessToken = authContext
.AcquireTokenAsync(graphResourceId, new ClientCredential(clientId, secret))
.Result
.AccessToken;
var graphserviceClient = new GraphServiceClient(
new DelegateAuthenticationProvider(requestMessage => {
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
return Task.FromResult(0);
}));
能否请您确认我的“权威”URL 是否正确?
string authority = "https://login.microsoftonline.com/{tenantId}/common/oauth2/v2.0/token?&response_type=code&scope=openid%20profile%20User.Read%20User.ReadWrite%20User.ReadBasic.All";
AuthenticationContext authContext = new AuthenticationContext(authority);
var accessToken = authContext
.AcquireTokenAsync(graphResourceId, new ClientCredential(clientId, secret))
.Result
.AccessToken;
最佳答案
您可以点击图形 API users/<email_id>
端点 ( https://graph.microsoft.com/v1.0/users/<email_id_of_the_user>
) 和适当的 Bearer token ,用于获取其他用户的基本详细信息。
您也可以在 Graph Explorer 中进行尝试 - https://developer.microsoft.com/en-us/graph/graph-explorer#
关于c# - Azure AD b2b "Read all users' 基本配置文件”权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52664523/