无法使用带有中文字符 Json 数据的 Azure Active Directory B2C Graph API 创建新用户
Unable to create new user using Azure Active Directory B2C Graph API with chinese character Json data
我正在尝试使用 AAD B2C 图创建用户 API。当 Payload Json 是英文字符时它工作正常,但是如果我创建带有中文字符的 Json Payload,它会失败。
Json 负载:
{
"passwordProfile": {
"password": "Abc1234@#",
"forceChangePasswordNextLogin": false
},
"signInNames": [
{
"type": "emailAddress",
"value": "abc@gmail.com"
}
],
"accountEnabled": true,
"creationType": "LocalAccount",
"displayName": "林",
"mailNickname": "林",
"passwordPolicies": "DisablePasswordExpiration"
}
错误详情:
"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
\"item\": \"PropertyName\",\r\n \"value\": \"mailNickname\"\r\n
},\r\n {\r\n \"item\": \"PropertyErrorCode\",\r\n
\"value\": \"InvalidValue\"\r\n }\r\n ]\r\n }\r\n})"
请帮我解决问题。
您需要指定错误指定的邮件昵称:
{
"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"
}
我还包含了文档中提到的其他必需属性。
我正在尝试使用 AAD B2C 图创建用户 API。当 Payload Json 是英文字符时它工作正常,但是如果我创建带有中文字符的 Json Payload,它会失败。
Json 负载:
{
"passwordProfile": {
"password": "Abc1234@#",
"forceChangePasswordNextLogin": false
},
"signInNames": [
{
"type": "emailAddress",
"value": "abc@gmail.com"
}
],
"accountEnabled": true,
"creationType": "LocalAccount",
"displayName": "林",
"mailNickname": "林",
"passwordPolicies": "DisablePasswordExpiration"
}
错误详情:
"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
\"item\": \"PropertyName\",\r\n \"value\": \"mailNickname\"\r\n },\r\n {\r\n \"item\": \"PropertyErrorCode\",\r\n
\"value\": \"InvalidValue\"\r\n }\r\n ]\r\n }\r\n})"
请帮我解决问题。
您需要指定错误指定的邮件昵称:
{
"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"
}
我还包含了文档中提到的其他必需属性。