我正在尝试通过 MVC Web 应用程序中的 Office365 应用程序下载电子邮件。我正在努力在 Azure Active Directory 上配置应用程序权限。权限说:“阅读所有邮箱中的邮件”,但是我想选择它可以访问/读取哪些邮箱。
有谁知道如何更具体地在 AAD 中设置权限?谢谢你的帮助。
string authority = "https://login.microsoftonline.com/" + SettingsHelper.TenantId + "/oauth2/token";
var credential = new ClientCredential(SettingsHelper.ClientId, SettingsHelper.ClientSecret);
AuthenticationContext authContext = new AuthenticationContext(authority);
var authResult = await authContext.AcquireTokenAsync("https://graph.microsoft.com", credential);
var graphserviceClient = new GraphServiceClient(
new DelegateAuthenticationProvider(
(requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", authResult.AccessToken);
return Task.FromResult(0);
}));
//This is Ok. I want to read this.
var allowedEmails = await graphserviceClient.Users["xxx@mydom.com"].Messages.Request().GetAsync();
//This is forbidden. I want to restrict this on AAD level. …Run Code Online (Sandbox Code Playgroud) authorization office365-apps azure-active-directory azure-ad-graph-api
我正在尝试获取 AAD 应用程序的客户端机密的到期日期。但是,当我使用以下图形请求时,passwordCredential 和 keyCredential 字段为空。
https://graph.windows.net/myorganization/directoryObjects/ {ServicePrincipalObjectId}/?api-version=1.6
有没有办法获取这些数据?如果我下载它,我会在清单中看到它,而不是在 Odata 对象中
感谢您的帮助!
我可以定义数据类型为 的自定义属性stringCollection并通过 Azure AD Graph API 更新它吗?我的实验失败了:
请求正文包含指定内容类型和编码的意外字符/内容
自定义属性定义
<ClaimType Id="extension_array_test">
<DisplayName>Array Test</DisplayName>
<DataType>stringCollection</DataType>
<UserHelpText>Array Test in Token</UserHelpText>
</ClaimType>
Run Code Online (Sandbox Code Playgroud)
{
"extension_[my-guid]_array_test": ["value 1", "value 2"]
}
Error Calling the Graph API:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "The request body contains unexpected characters/content for the specified content type and encoding."
}
}
}
Run Code Online (Sandbox Code Playgroud) 我是 Microsoft API 的新手。我已经创建了设备、房间和房间列表,但我无法将设备添加/连接到房间。我也找不到任何关于此的足够文件。
有没有办法使用Microsoft API在会议室中添加和获取设备?
outlook exchangewebservices azure-ad-graph-api microsoft-graph-api
在使用 MSAL-Angular 并为 Azure Active Directory 图形 api( https://graph.windows.net/ )请求 access_token 时,它提供带有 Microsoft 图形 api( https://graph.microsoft.com ) aud 的令牌
我需要调用 azure 活动目录图形 api,因为 Microsoft 图形 api 处于测试版。现在,当我使用 msalService 获取 Azure Active Directory 图形 api 的 access_token 时,它会提供带有 microsoft 图形 api aud 的令牌。当我尝试使用该令牌时,它给出了“您的访问令牌已过期”的错误。请在提交请求之前更新它。即使令牌具有有效时间。
我使用下面的打字稿代码来生成 access_token public async getAccessToken(endpointUri: string): Promise {
this.accessToken = '';
const scopes = this.msalService.getScopesForEndpoint(endpointUri);
return new Promise<boolean>((resolve, reject) => {
this.msalService.acquireTokenSilent(scopes)
.then(accessToken => {
this.accessToken = accessToken;
resolve(true);
// tslint:disable-next-line: promise-function-async
}).catch(() => {
return this.msalService.acquireTokenPopup(scopes)
.then(token …Run Code Online (Sandbox Code Playgroud) azure-active-directory azure-ad-graph-api azure-ad-msal angular
我正在尝试使用图形 API 获取多租户应用程序的所有用户。为此,我使用请求生成了访问令牌:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id=535fb089-9ff3-47b6-9bfb-4f1264799865
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=qWgdYAmab0YSkuL1qKv5bPX
&grant_type=client_credentials
Run Code Online (Sandbox Code Playgroud)
注意:请注意,在上述请求中,我使用common代替{tenantID}. 这只是一次点击和尝试,就像文档中为 adminConsent 建议的那样。
通过使用上面生成的访问令牌,我请求用户 API 并收到以下错误
{
"error": {
"code": "Authorization_IdentityNotFound",
"message": "The identity of the calling application could not be established.",
"innerError": {
"request-id": "56141b7d-dd5e-44b1-9395-cd15d02b52de",
"date": "2019-06-17T12:42:19"
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用租户 ID 生成令牌时,它仅返回一个活动目录的用户。
谁能建议我哪里出错了?
active-directory azure multi-tenant onedrive azure-ad-graph-api
我正在使用 MSAL 使用集成 Windows 身份验证从 Azure 中的身份验证应用程序获取令牌。代码是:
var tenant = $"https://login.microsoftonline.com/<myTenantId>";
var clientId = "<myClientId>";
var scopes = new string[] { "https://graph.microsoft.com/.default" };
var publicApplication = PublicClientApplicationBuilder.Create(clientId).WithAuthority(tenant).Build();
var token = await publicApplication.AcquireTokenByIntegratedWindowsAuth(scopes).ExecuteAsync();
Run Code Online (Sandbox Code Playgroud)
这会引发以下异常:
Integrated Windows Auth is not supported for managed users.
Run Code Online (Sandbox Code Playgroud)
我已按照https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Integrated-Windows-Authentication中的步骤进行操作,据我所知,我没有错过任何内容。
我的配置中是否遗漏了某些内容?对此的任何帮助都将受到高度赞赏。
azure azure-active-directory azure-ad-graph-api azure-ad-msal azure-authentication
azure azure-active-directory azure-ad-graph-api azure-devops azure-devops-rest-api
我有一个基于 django 的 Web 应用程序,客户端要求我们将登录名与 Azure AD 集成,遵循我设法与以下流程集成的文档。在 django 中,用户只输入电子邮件,我识别用户和他的公司并将他重定向到微软广告登录屏幕,登录后,重定向 uri 被激活,在我看来,我做了一些验证并在我的系统上对用户进行身份验证。问题是,每次客户要登录时,他都需要在azure中输入他的凭据,是否可以使用microsoft user_id或用户第一次登录时获得的令牌?或者其他更快的登录方式?
这是我的回调视图,在 redirect_uri 中调用:
def callback(request):
user_id = request.session.pop('user_id', '')
user_internal = User.objects.filter(id=user_id).first()
company_azure = CompanyAzureAd.objects.filter(company=user_internal.employee.firm).first()
# Get the state saved in session
expected_state = request.session.pop('auth_state', '')
# Make the token request
url = request.build_absolute_uri(request.get_full_path())
token = get_token_from_code(url, expected_state, company_azure)
# Get the user's profile
user = get_user(token) #in this moment i have user microsoft profile, with token and id
# Save token and user
store_token(request, token)
store_user(request, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 microsoft graph mail api 使用 in 运算符查询少量电子邮件,但找不到示例。
这就是我尝试使用它的方式:https :
//graph.microsoft.com/v1.0/me/messages?$filter=(from/emailAddress/address) in'test@email.com, tester@address.com'
在他们的文档中,它说您可以将 in 运算符用于 $filter。
azure odata office365 azure-ad-graph-api microsoft-graph-api
azure ×5
angular ×1
azure-ad-b2c ×1
azure-devops ×1
django ×1
multi-tenant ×1
odata ×1
office365 ×1
onedrive ×1
outlook ×1
python ×1