[英]Create user with other mail provider in Azure AD B2C (gmail,etc...)
I used Microsoft Graph API PHP SDK to add user in my Azure Active Directory B2C.我使用 Microsoft Graph API PHP SDK 在我的 Azure Active Directory B2C 中添加用户。 I managed to create users with a
userPrincipalName
like name@mytenantid.onmicrosoft.com
.我设法使用
userPrincipalName
创建用户,例如name@mytenantid.onmicrosoft.com
。
I wasn't able to add users with a GMail address such as john.doe@gmail.com
.我无法添加地址为 GMail 的用户,例如
john.doe@gmail.com
。
I tried to add the signInNames
collection but I got the following response:我尝试添加
signInNames
集合,但收到以下响应:
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error:
POST https://graph.microsoft.com/v1.0/users resulted in a 400 Bad Request
response:
{ "error": {
"code": "Request_BadRequest",
"message": "Invalid property 'signInNames'.",
"innerError": (truncated...)
Here is my JSON request body:这是我的 JSON 请求正文:
{
"accountEnabled": true,
"displayName": "John Doe",
"userPrincipalName": "john@doe.fr",
"creationType": "LocalAccount",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "P@!ssWor?D"
},
"signInNames": [
{
"type": "emailAddress",
"value": "john@doe.fr"
}
]
}
You're confusing Microsoft Graph API with the Azure AD Graph API . 您将Microsoft Graph API与Azure AD Graph API混淆了。 These are two different APIs.
这是两个不同的API。 While they share a lot of functionality, calls to these APIs are not interchangeable.
尽管它们共享许多功能,但对这些API的调用不可互换。
The User object in Microsoft Graph API doesn't support a signInNames
property. Microsoft Graph API中的User对象不支持
signInNames
属性。 This is why it is returning that error. 这就是为什么它返回该错误的原因。
Local account users are not supported by Microsoft Graph API at the moment. Microsoft Graph API目前不支持本地帐户用户。
In case if someone will still have the same problem, in MS Graph Api you can use "identities" instead of "signInNames" and your JSON will look like如果有人仍然遇到同样的问题,在 MS Graph Api 中你可以使用“identities”而不是“signInNames”,你的 JSON 看起来像
{
"accountEnabled":true,
"displayName":"John Doe",
"userPrincipalName":"john@doe.fr",
"creationType":"LocalAccount",
"passwordProfile":{
"forceChangePasswordNextSignIn":true,
"password":"P@!ssWor?D"
},
"identities":[
{
"signInType":"emailAddress",
"issuer":"<your tenant domain name>",
"issuerAssignedId":"john@doe.fr"
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.