我想获取有权使用该应用程序的用户列表。
无法在 native 应用程序中输入 key 。我尝试在登录时使用相同的 accessToken。身份验证工作正常。 ObjectId 与我的 native 应用程序 ObjectId 相同。
result = await authContext.AcquireTokenAsync(graphResourceId, _ADClientId, redirectUri, new PlatformParameters(PromptBehavior.Never));
string accessToken = result.AccessToken;
ActiveDirectoryClient activeDirectoryClient = new ActiveDirectoryClient(serviceRoot, async () => await Task.FromResult(accessToken));
var groupFetcher = (IGroupFetcher)activeDirectoryClient.Groups.ExecuteAsync().Result.CurrentPage.First(g => g.ObjectId == "5deedc8c-2ba6-45d8-a4f2-xxxxxxx");
错误:Authorization_RequestDenied
出了什么问题?
最佳答案
在 Azure Active Directory 中,转到应用程序注册并添加 Windows Active Directory API 的委托(delegate)权限。我不确定您可以选择的最小权限是什么(也许登录并读取用户个人资料可能有效),但读取目录数据将为您提供必要的权限:
关于c# - 如何从 Azure Active Directory( native 应用程序)获取用户列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50853439/