我正在从 Azure AD Graph API 迁移到 Microsoft Graph,因为它现已弃用。以前可以使用Microsoft.Azure.ActiveDirectory.GraphClient .GetExtendedProperties();调用来访问用户的扩展属性,例如:
var client = new ActiveDirectoryClient(serviceRoot, async () => await GetToken());
var user = await client.Users["user id..."].ExecuteAsync();
var properties = user.GetExtendedProperties();
Run Code Online (Sandbox Code Playgroud)
我需要使用 中的等效调用来复制此内容Microsoft Graph。
我查看了schemaExtensions端点,例如:
获取所有扩展名:
/v1.0/schemaExtensions
但这似乎不会返回与 AD Graph 客户端相同的扩展数据。
使用 ext 获取用户:
v1.0/users/[user id]?$expand=extensions&$select=id,extension_[application id]_myExtension,onPremisesExtensionAttributes,displayName,jobTitle,identities
哪里extension_[application id]_myExtension有格式示例扩展:
extension_appid_extensionname
并且这不会返回用户的自定义扩展数据(但是其他属性工作正常)。
我们如何将扩展属性从 AD Graph 客户端迁移到 Microsoft Graph?
c# azure azure-active-directory azure-ad-graph-api microsoft-graph-api
我们创建了内置的密码重置用户流程。
我们使用 Microsoft Graph API 在 B2C 中自动注册用户,并发送一封电子邮件,其中包含密码重置流程的直接链接,以便他们在首次登录时重置密码。
用户正确完成密码重置用户流程,并将其重定向回我们的应用程序,该应用程序将用户重定向到我们的SignIn自定义策略用户旅程!
我们有 Home Realm Discovery,用户首先会看到一个屏幕来输入他们的电子邮件地址,单击“下一步”,然后输入密码。
输入电子邮件地址并单击“下一步”后,我们收到以下错误:
Sorry, but we're having trouble signing you in.
We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, please try again.
Correlation ID: d5a7e1ed-a6d2-4b6d-bc87-b8612a5419b4
Timestamp: 2021-05-27 12:19:05Z
AADB2C: An exception has occurred.
Run Code Online (Sandbox Code Playgroud)
这是 UserJourney 和 SubJourney:
<UserJourneys>
<UserJourney Id="HRDSignUpSignInMFAEmebeddedPasswordReset">
<OrchestrationSteps>
<OrchestrationStep Order="1" Type="ClaimsExchange">
<ClaimsExchanges>
<ClaimsExchange Id="ParseDomainHint" TechnicalProfileReferenceId="ParseDomainHint" />
</ClaimsExchanges>
</OrchestrationStep>
<!-- api.hrd reference to custom login …Run Code Online (Sandbox Code Playgroud) change-password azure-ad-graph-api azure-ad-b2c microsoft-graph-api aad-b2c
我正在尝试使用带有以下代码的Office 365统一API列出用户:
$TenantID = "xxx"
$F_ClientID = "yyy"
$F_ClientSecret = "zzz"
Add-Type @'
using System;
public class OAuthContext{
public string AccessToken{get;set;}
public string TokenType{get;set;}
public string ExpiresIn{get;set;}
public string RefreshToken{get;set;}
}
'@
$Uri = "https://login.microsoftonline.com/$($TenantID)/oauth2/token"
$ContentType = 'application/x-www-form-urlencoded'
$Headers = @{}
$Body = [System.Text.Encoding]::UTF8.GetBytes('grant_type=client_credentials&client_id='+$F_ClientID+'&client_secret='+$F_Clie ntSecret+'&resource"=https://graph.microsoft.com')
$Response = Invoke-RestMethod -Method POST -Uri $Uri -Headers $Headers -ContentType $ContentType -Body $Body
$Response
$Context = New-Object OAuthContext
$Context.AccessToken = $Response.access_token
$Context.ExpiresIn = $Response.expires_in
$Context.RefreshToken = $Response.refresh_token
$Context.TokenType = $Response.token_type
$Context
$Headers = @{}
$Headers.Add('Authorization',$Context.TokenType …Run Code Online (Sandbox Code Playgroud) powershell office365 office365api azure-ad-graph-api office365-restapi
When we create a user in Active Directory using Graph API, some characters are appended to the username (#EXT#). This makes impossible to edit the user in AD B2C's interface (documented problem) or doing sign-in using ADAL 2.23 (Active Directory Authentication Library).
Particularly, there's an error (unknown_user_type) when we use AcquireToken(username, password) method. The error is the following:
为什么会这样?是否有针对此问题的任何解决方案或解决方法?
问候。
azure azure-active-directory azure-ad-graph-api azure-ad-b2c
我需要进行以下POST调用.但是,即使我提供了正确的客户端ID和密码ID,我的电话也会被拒绝.
curl POST https://login.microsoftonline.com/f02....e3/oauth2/token
-H 'Content-Type: application/x-www-form-urlencoded' --data 'grant_type=authorization_code&redirect_uri=https://requestb.in/ac&
source=https://graph.microsoft.com&client_id=1e1....-913d9
&client_secret=YmbSFYz.....4Uk=&scope=mail.read&code=AaAAA........on0a569'
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误:
curl: (6) Could not resolve host: POST
{"error":"invalid_client","error_description":"AADSTS70002:
Error validating credentials. AADSTS50012: Invalid client secret is
provided.\r\nTrace ID: 78d...a2b\r\nCorrelation ID:
01....ab2\r\nTimestamp: 2016-12-14 01:46:47Z","error_codes":[70002,50012],"timestamp":"2016-12-14 01:46:47Z","trace_id":"78d....a2b","correlation_id":"018.....ab2"}
Run Code Online (Sandbox Code Playgroud)
我怎么能解决这个问题?
编辑:我正在尝试在本文档中实现第二部分(即获取令牌)
我正在构建一个本地iOS应用程序,并希望使用AADB2C作为身份提供者,用户可以在其中登录,注册,重设密码等。
我无法找到一种方法,让用户使用AADB2C(或与此相关的常规AAD)进行注册,而无需将他们重定向到(可自定义但仍然可以)Microsoft网站。明确地说:我想让客户从本机iOS窗体在AAD上创建用户帐户,而最好不要通过REST请求将其重定向到网站。(如“创建消费者用户帐户”下的此处所示:https : //docs.microsoft.com/zh-cn/azure/active-directory-b2c/active-directory-b2c-devquickstarts-graph-dotnet)
我尝试了https://github.com/Azure-Samples/active-directory-dotnet-graphapi-console/tree/master/GraphConsoleAppV3中的 graphapi代码.它适用于我的本地系统.在本地计算机上,它弹出一个窗口并要求登录.但是当我将应用程序部署到azure Web门户时,它在获取令牌的时候失败了Itenent.
"错误HRESULT E_FAIL已从调用COM组件返回"[COMException(0x80004005):错误HRESULT E_FAIL已从调用COM组件返回.
我认为这是从本地系统搜索令牌.我的令牌检索选项是否与Windows或Web相关?有关代码更改的任何建议.
如何在部署时替换此应用程序以使其工作.我想如果我们可以改变ITenantDetail tenantDetail = GetTenantDetailsSync(client,UserModeConstants.TenantId); 代码从一个从用户获取信息,这也应该在网络上工作.
private static ActiveDirectoryClient client;
client = AuthenticationHelper.GetActiveDirectoryClientAsUser();
ITenantDetail tenantDetail = GetTenantDetailsSync(client, UserModeConstants.TenantId);
public static ITenantDetail GetTenantDetailsSync(IActiveDirectoryClient client, string tenantId)
{
ITenantDetail tenant = null;
try
{
IPagedCollection<ITenantDetail> tenantsCollection = client.TenantDetails
.Where(tenantDetail => tenantDetail.ObjectId.Equals(tenantId)).ExecuteAsync().Result;
List<ITenantDetail> tenantsList = tenantsCollection.CurrentPage.ToList();
if (tenantsList.Count > 0)
{
tenant = tenantsList.First();
}
}
catch (Exception ex)
{
}
if (tenant == null)
{
return null;
}
else
{
TenantDetail tenantDetail = (TenantDetail)tenant;
return …Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc azure-web-sites azure-active-directory azure-ad-graph-api
我正在使用oauth2 / token验证我的应用程序并获取access_token。贝娄是运行良好的Java代码。
private String getToken() throws Exception {
String access_token = "";
String url = "https://login.windows.net/MyApplication_ID_here/oauth2/token";
HttpClient client = HttpClients.createDefault();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "application/x-www-form-urlencoded");
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("grant_type", "client_credentials"));
urlParameters.add(new BasicNameValuePair("client_id", "MyApplication_ID_here"));
urlParameters.add(new BasicNameValuePair("client_secret", "MyApplication_secret_here"));
urlParameters.add(new BasicNameValuePair("resource", "https://graph.microsoft.com"));
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
System.out.println("Sending 'POST' request to URL : " + url);
System.out.println("Post parameters : " + post.getEntity());
System.out.println("Response Code : " + response.getStatusLine().getStatusCode());
String responseAsString = EntityUtils.toString(response.getEntity());
System.out.println(responseAsString);
try …Run Code Online (Sandbox Code Playgroud) oauth-2.0 office365 azure-active-directory azure-ad-graph-api microsoft-graph
我想在哪里查看AzureAD版本?是否有一些命令行实用程序可以返回版本,或者某些休息端点提供类似的基本信息?
我想使用此库与我的广告的图API进行交互-https: //github.com/microsoftgraph/microsoft-graph-docs/blob/master/concepts/nodejs.md
但是,我发现所有用于返回访问令牌的现有javascript库都希望传递一个返回URL,以及一些其他特定于Web的东西,这使我相信这是Microsoft的某种要求。
在运行后端节点脚本(与网络无关)时,是否有任何好的方法来认证/接收访问令牌,以便可以开始针对Microsoft Graph API进行调用?在此先感谢您的建议。
azure ×3
azure-ad-b2c ×3
c# ×2
office365 ×2
office365api ×2
aad-b2c ×1
adal ×1
asp.net-mvc ×1
curl ×1
node.js ×1
oauth-2.0 ×1
powershell ×1