简体   繁体   English

无法使用带有中文字符Json数据的Azure Active Directory B2C Graph API创建新用户

[英]Unable to create new user using Azure Active Directory B2C Graph API with chinese character Json data

I am trying to create a user using AAD B2C graph API. 我正在尝试使用AAD B2C图形API创建用户。 It is working fine when the Payload Json is English Character, but If I create the Json Payload with a Chinese character, Its fails. 当有效载荷Json是英文字符时,它可以正常工作,但是如果我创建带有中文字符的Json有效载荷,则它将失败。

Json Payload: 杰森有效载荷:

    {
  "passwordProfile": {
    "password": "Abc1234@#",
    "forceChangePasswordNextLogin": false
  },
  "signInNames": [
    {
      "type": "emailAddress",
      "value": "abc@gmail.com"
    }
  ],
  "accountEnabled": true,
  "creationType": "LocalAccount",
  "displayName": "林",
  "mailNickname": "林",
  "passwordPolicies": "DisablePasswordExpiration"
}

Error Details: 错误详情:

"Message": "One or more errors occurred. (Error Calling the Graph API: \\n{\\r\\n \\"odata.error\\": {\\r\\n \\"code\\": \\"Request_BadRequest\\",\\r\\n \\"message\\": {\\r\\n \\"lang\\": \\"en\\",\\r\\n \\"value\\": \\"Invalid value specified for property 'mailNickname' of resource 'User'.\\"\\r\\n },\\r\\n \\"requestId\\": \\"b2d0d3bf-394d-4ebd-a5b5-d905f1809c19\\",\\r\\n \\"date\\": \\"2019-02-15T06:55:06\\",\\r\\n \\"values\\": [\\r\\n {\\r\\n “ Message”:“发生一个或多个错误。(调用图形API时出错:\\ n {\\ r \\ n \\” odata.error \\“:{\\ r \\ n \\” code \\“:\\” Request_BadRequest \\“, \\ r \\ n \\“消息\\”:{\\ r \\ n \\“ lang \\”:\\“ en \\”,\\ r \\ n \\“ value \\”:\\“为资源'的属性'mailNickname'指定的值无效用户'。\\“ \\ r \\ n},\\ r \\ n \\” requestId \\“:\\” b2d0d3bf-394d-4ebd-a5b5-d905f1809c19 \\“,\\ r \\ n \\” date \\“:\\” 2019-02 -15T06:55:06 \\“,\\ r \\ n \\”值\\“:[\\ r \\ n {\\ r \\ n
\\"item\\": \\"PropertyName\\",\\r\\n \\"value\\": \\"mailNickname\\"\\r\\n },\\r\\n {\\r\\n \\"item\\": \\"PropertyErrorCode\\",\\r\\n \\“ item \\”:\\“属性名称\\”,\\ r \\ n \\“值\\”:\\“ mailNickname \\” \\ r \\ n},\\ r \\ n {\\ r \\ n \\“ item \\”:\\“ PropertyErrorCode \\”,\\ r \\ n
\\"value\\": \\"InvalidValue\\"\\r\\n }\\r\\n ]\\r\\n }\\r\\n})" \\“ value \\”:\\“ InvalidValue \\” \\ r \\ n} \\ r \\ n] \\ r \\ n} \\ r \\ n})“

Please help me to solve the issue. 请帮我解决问题。

You need to specify the mailNickname as specified by the error: 您需要指定错误所指定的mailNickname:

{
  "givenName": "会话",
  "surname": "宋",
  "mail": "abc@gmail.com",
  "city": "TestCity",
  "state": "hebei",
  "country": "china",
  "postalCode": "1245",
  "mobilePhone": "12345678",
  "mailNickname": "abc",
  "accountEnabled": true,
  "displayName": "displayname-here",
  "passwordProfile": {
    "password": "PasswordHere",
    "forceChangePasswordNextLogin": true
  },
  "userPrincipalName": "abc@gmail.com"
}

I've also included the other properties the documentation mentions are required. 我还包括了文档中提到的其他属性。

You can see the reference here: https://docs.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations#create-a-user-work-or-school-account-- 您可以在此处查看参考: https : //docs.microsoft.com/zh-cn/previous-versions/azure/ad/graph/api/users-operations#create-a-user-work-or-school-account -

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用http post请求使用Graph API在Azure Active Directory(B2C)中创建新用户 - Create a new user in Azure Active Directory (B2C) with Graph API, using http post request 如何使用Azure Active Directory B2C GraphServiceClient创建Global Administrator用户? - How to create Global Administrator user using Azure Active Directory B2C GraphServiceClient? 使用 B2C 图形 API 获取用户的 Azure 目录角色 - Get Azure directory role of the user using B2C graph API 如何使用 Azure Active Directory Graph Client 在 Azure B2C 中查找具有相同用户名\电子邮件地址的所有用户? - How to find all users with the same User name\email address in Azure B2C using Azure Active Directory Graph Client? 为新的Azure Active Directory B2C用户设置密码的最安全方法是什么? - What is safest way to set password for new Azure Active Directory B2C user? 无法使用GraphServiceClient更新Azure Active Directory B2C用户 - ASP.NET MVC - Can't update Azure Active Directory B2C user using GraphServiceClient - ASP.NET MVC Azure Active Directory B2C 注册 - Azure Active Directory B2C registration 使用Graph API在Azure AD B2C中创建具有自定义属性的用户 - Create user with Custom Attributes in Azure AD B2C with Graph API 无法通过 Azure AD B2C 属性中的 Graph API 创建用户不存在 - Cant create user over Graph API in Azure AD B2C property not present Azure B2C - 使用 Graph API 注册用户,而不是使用用户流/自定义策略 - Azure B2C - using Graph API to register users instead of using user flows / custom policies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM