简体   繁体   English

B2C Graph API 更新用户、UserPrincipalName 作为电子邮件:URL 不支持加号 (+) 登录电子邮件?

[英]B2C Graph API Update User, UserPrincipalName as an email: URL does not support plus (+) sign in email?

I was testing a PATCH request to the Graph API here: https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}我在这里测试对 Graph API 的 PATCH 请求: https://graph.microsoft.com/v1.0/users/{id | userPrincipalName} https://graph.microsoft.com/v1.0/users/{id | userPrincipalName} to update accountEnabled attribute. https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}更新accountEnabled属性。

The documentation states that this is the format: https://docs.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http文档指出这是格式: https ://docs.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http

I did a POST request earlier and successfully made a user with userPrincipalName as an email (within identities array for B2C user), that is something like emailaddress+1@gmail.com我之前做了一个 POST 请求,并成功地将userPrincipalName作为电子邮件的用户(在 B2C 用户的身份数组中),类似于emailaddress+1@gmail.com

When I try to put that in the URL as the userPrincipalName , I get unknownError back from the graph API.当我尝试将其作为userPrincipalName放入 URL 时,我从图形 API 中得到unknownError After some experimenting, I found it was the + in the URL which would make sense.经过一些试验,我发现 URL 中的+是有意义的。 However, a UrlEncode to %2b for + also does not work.但是,对于+%2bUrlEncode也不起作用。 Encoding the @ symbol even throws an error by the API?编码 @ 符号甚至会引发 API 错误?

Is this not supported by the API URL? API URL 不支持吗? Within the B2C Users panel in Azure portal, all I see for user principal name is that email I made them with that original POST request.在 Azure 门户的 B2C 用户面板中,我看到的所有用户主体名称都是我使用原始 POST 请求向他们发送的电子邮件。 The only solution I can think of is to not allow users to sign up in the first place with that + sign in their email.我能想到的唯一解决方案是首先不允许用户在他们的电子邮件中使用 + 登录来注册。 Using User/object ID is not possible in my case.在我的情况下,使用用户/对象 ID 是不可能的。

Allowed characters for userPrincipalName are A - Z , a - z , 0 - 9 , ' . - _ ! # ^ ~ userPrincipalName 允许的字符是A - Za - z0 - 9' . - _ ! # ^ ~ ' . - _ ! # ^ ~ ' . - _ ! # ^ ~ . ' . - _ ! # ^ ~ . Read more about username policies in the documentation .文档中阅读有关用户名策略的更多信息。

It would be interesting to know if indeed you were able to create a user with a character in the userPrincipalName that is not allowed or if the API ignored/removed/converted the + sign.知道您是否确实能够使用不允许的 userPrincipalName 字符创建用户,或者 API 是否忽略/删除/转换了+号,这将是一件有趣的事情。 Can you get the Id of the user by searching on the Azure Portal?你可以通过在 Azure Portal 上搜索得到用户的Id吗? Then you can Get the user and see the value of userPrincipalName .然后您可以获取用户并查看userPrincipalName的值。

暂无
暂无

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

相关问题 Microsoft Graph API 通过email地址获取多个B2C用户 - Microsoft Graph API get multiple B2C user via email address 如何在没有Graph API的C#Azure B2C身份验证中获取当前登录用户的用户名和电子邮件地址? - How to get current login user's username & email address in C# Azure B2C authentication without Graph API? 使用图形 API 登录 Azure B2C - Azure B2C sign in using Graph API Azure AD B2C.Net SDK - 通过 Email 检索用户 - Azure AD B2C .Net SDK - Retrieve User by Email 如何使用 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 B2C 检查用户 email Id 是否存在或不使用 ASP.NET Core 3.1 MVC 中的图表 - Azure B2C check user email Id exists or not using Graph in ASP.NET Core 3.1 MVC Azure AD B2C-自定义注册页面,电子邮件验证 - Azure AD B2C - custom sign up page, email verification 在 C# 中通过 Microsoft Graph API 更新用户在 Email 地址中的登录 - Updating User's sign in Email Address via Microsoft Graph API in C# Azure B2C 注销,然后登录不会使用密码提示挑战用户 - Azure B2C Sign Out, then Sign In does not challenge the user with a password prompt 具有指定电子邮件地址的 Azure Active Directory B2C 登录用户 - Azure Active Directory B2C log in user with specified email address
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM