[英]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.但是,对于
+
的%2b
的UrlEncode
也不起作用。 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 - Z
、 a - z
、 0 - 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.