AAD B2C: 在尝试按身份筛选时返回值:[]

huangapple go评论71阅读模式
英文:

AAD B2C: Returning value: [] when trying to filter by identities

问题

I'm using Microsoft AAD B2C with User Flow.

I have a user that returns those identities objects:

"identities": [
{
"signInType": "phoneNumber",
"issuer": "ourtenant.onmicrosoft.com",
"issuerAssignedId": "+55444444444"
},
{
"signInType": "userPrincipalName",
"issuer": "ourtenant.onmicrosoft.com",
"issuerAssignedId": "ausdhasuduasd@ourtenant.onmicrosoft.com"
}
],

I'm trying to filter by:

https://graph.microsoft.com/beta/tenant.onmicrosoft.com/users?$filter=(identities/any(i:i/issuer eq 'ourtenant.onmicrosoft.com' and i/issuerAssignedId eq '55444444444'))
https://graph.microsoft.com/v1.0/users?$select=id,displayName,identities&$filter=identities/any(c:c/issuerAssignedId eq '+55444444444' and c/issuer eq 'ourtenant.onmicrosoft.com')

But it returns only:

{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users",
"value: []
}

I also tried to swap i for c, x, the filter order, without select, but it doesn't work, only returns value: [].

The tenant is correct, and the user's number is correct.
I tried to use beta and also v1.0. Tried to filter with "startsWith" on phoneNumber, but it doesn't return anything.

英文:

I'm using Microsoft AAD B2C with User Flow.

I have a user that returns those identities objects:

        "identities": [
            {
                "signInType": "phoneNumber",
                "issuer": "ourtenant.onmicrosoft.com",
                "issuerAssignedId": "+55444444444"
            },
            {
                "signInType": "userPrincipalName",
                "issuer": "ourtenant.onmicrosoft.com",
                "issuerAssignedId": "ausdhasuduasd@ourtenant.onmicrosoft.com"
            }
        ],

I'm trying to filter by:

https://graph.microsoft.com/beta/tenant.onmicrosoft.com/users?$filter=(identities/any(i:i/issuer eq 'ourtenant.onmicrosoft.com' and i/issuerAssignedId eq '55444444444'))
https://graph.microsoft.com/v1.0/users?$select=id,displayName,identities&$filter=identities/any(c:c/issuerAssignedId eq '+55444444444' and c/issuer eq 'ourtenant.onmicrosoft.com')

But it returns only:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users",
    "value": []
}

I also tried to swap i for c, x, the filter order, without select, but it doesn't work, only returns value: [].

The tenant is correct, and the user's number is correct.
I tried to use beta and also v1.0. Tried to filter with "startsWith" on phoneNumber, but it doesn't return anything.

答案1

得分: 1

I tried to reproduce the same in my environment and got the results like below:
我尝试在我的环境中复制相同的操作,并得到了如下结果:

I fetched the identities of the user:
我获取了用户的身份信息:

When I tried to filter the identities, I faced the same issue as below:
当我尝试筛选身份信息时,我遇到了与下面相同的问题:

The issue usually occurs if you are passing wrong values while calling the API.
通常,如果在调用API时传递了错误的值,就会出现此问题。

  • Try adding + while passing the phone number like below:
  • 尝试在传递电话号码时添加 +,如下所示:

If still the issue persists, try fetching another user and check if the user account has sufficient privileges to perform the action.
如果问题仍然存在,请尝试获取另一个用户并检查用户帐户是否具有足够的权限来执行操作。

I am able to execute the query successfully like below:
我可以成功执行以下查询:

References:
参考资料:

List users - Microsoft Graph v1.0

User query $filter ignores identities/issuer - MS Graph API and Azure B2C by Andrew Campbell

英文:

I tried to reproduce the same in my environment and got the results like below:

I fetched the identities of the user:

https://graph.microsoft.com/beta/users/UserId/identities

AAD B2C: 在尝试按身份筛选时返回值:[]

When I tried to filter the identities, I faced the same issue as below:

https://graph.microsoft.com/v1.0/users?$select=displayName,id&$filter=identities/any(c:c/issuerAssignedId eq 'xxx' and c/issuer eq 'xxx')

AAD B2C: 在尝试按身份筛选时返回值:[]

The issue usually occurs if you are passing wrong values while calling the API.

  • Try adding + while passing the phone number like below:
https://graph.microsoft.com/v1.0/tenant.onmicrosoft.com/users?$filter=(identities/any(i:i/issuer eq 'ourtenant.onmicrosoft.com' and i/issuerAssignedId eq '+55444444444'))
  • If still the issue persists, try fetching another user and check if the user account has sufficient privileges to perform the action.

I am able to execute the query successfully like below:

https://graph.microsoft.com/v1.0/users?$select=displayName,Identities&$filter=identities/any(c:c/issuerAssignedId eq 'xxx' and c/issuer eq 'xxx')

AAD B2C: 在尝试按身份筛选时返回值:[]

References:

List users - Microsoft Graph v1.0

User query $filter ignores identities/issuer - MS Graph API and Azure B2C by Andrew Campbell

huangapple
  • 本文由 发表于 2023年3月4日 03:21:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631104.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定