[英]Azure AD B2C updating users sign in names results in error
When I'm trying to update the list of SignInNames
, I get the error: Resource <EMAIL ADDRESS> does not exist or one of its queried reference-property objects are not present
. 当我尝试更新
SignInNames
列表时,我收到错误: Resource <EMAIL ADDRESS> does not exist or one of its queried reference-property objects are not present
。
var currentUser = await GetUserByUserNameAsync(userId); // this gets the user
var signinNames = currentUser.SignInNames.ToList();
signinNames.Add(new SignInName
{
Type = "emailAddress",
Value = newEmailaddress
});
var data = new B2CChangeEmailAddressData()
{
SignInNames = signinNames
};
var response = await _graphApi.SendAsync(new HttpMethod("PATCH"), $"users/{userId}", null, data);
And then it returns the error. 然后它返回错误。 I use comparable code to update the password, that works fine.
我使用类似的代码来更新密码,这很好。 Am I overlooking something?
我忽略了什么吗?
So, what I did was: 所以,我做的是:
The first is possible, but the second isn't. 第一种是可能的,但第二种不是。 I had to update the user by using the
ObjectId
. 我不得不使用
ObjectId
更新用户。 So the code should be: 所以代码应该是:
var currentUser = await GetUserByUserNameAsync(userId);
var path = $"users/{currentUser.ObjectId}";
var signinNames = new List<SignInName>();
signinNames.Add(new SignInName
{
Type = "emailAddress",
Value = newEmailaddress
});
var data = new B2CChangeEmailAddressData()
{
SignInNames = signinNames
};
var response = await _graphApi.SendAsync(new HttpMethod("PATCH"), path, null, data);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.