服务主体调用AD图API所需的权限是什么:通过对象ID获取对象:
POST https://graph.windows.net/ {tenantID} /getObjectsByObjectIds?api-version=1.6
我使用
设置了一个应用应用程序许可:读取目录数据。
委派的权限:
读取目录数据 读写目录数据 阅读所有用户的完整资料 登录并阅读用户个人资料。
但是在进行API调用时,我收到了禁止访问(状态代码403):
我也通过以下代码获得了访问令牌:
字符串授权=“ https://login.microsoftonline.com/” +“ microsoft.com”;
AuthenticationContext ac = new AuthenticationContext(authority);
ClientCredential cr = new ClientCredential("Appid", "Cred");
string OfficeUrl = "https://graph.windows.net";
AuthenticationResult authenticationResult = ac.AcquireTokenAsync(OfficeUrl, cr).Result;
string token = authenticationResult.AccessToken;
// string token = this.SetAuthorizationToken();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);