c# - Azure AD b2b "Read all users' 基本配置文件”权限

标签 c# microsoft-graph-api

我已委派用户权限 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#

enter image description here

关于c# - Azure AD b2b "Read all users' 基本配置文件”权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52664523/

相关文章:

c# - 更新 Windows 8 C# Metro 应用程序的 GUI

c# - Page.Header.Controls.Add(control) 将控件添加到 <body> 而不是 <head>

azure-active-directory - 获取有关特定 Azure 目录的用户 Graph Explorer

javascript - 为什么 Microsoft Graph 列表订阅会返回原来的内容?

node.js - 如何在 Node.js 中的 azure Active Directory 上获取登录用户的 token

azure-active-directory - 无法使用 beta Graph API 创建密码 AAD 应用程序

C# Process.Start 和 Process.StartInfo 错误

c# - 需要 SearchBar 给出相同的结果,无论其字母是否大写

c# - 如何从 MySQL 数据库内容动态创建 Access DB 并保存在本地

iOS客户端: I can have user sign into Active Directory,但是如何访问MS Graph API?