Auth0 Home Blog Docs

Management API and List Users

management-api
users
users-list

#1

I am trying to list all my users into a datatable in my Angular 4 app. I get the list of users but the ones who created their users themselves via login widget signup and the ones I create from the management API are completely different and when I try to use the JSON response to list them I get shown only the ones that were created using the sign up and not the other ones, even tho I can see them on the JSON object, I believe it has something to do with the object nature as they are different.
Please any advice would be greatly appreciated.


#2

Can you update your question to provide an example of a user profile that displays, and one that doesn’t? One thing to note is that the user_profile can differ based on which Identity provider the user signed up using. E.g Facebook users will have additional attributes to a normal database connection user. I suggest looking at the user_profile structure to make sure you are attempting to display data that is available:
https://auth0.com/docs/user-profile/user-profile-structure


#3
    {
        "email_verified": true,
        "email": "xxx@xxx.com",
        "updated_at": "2017-07-17T20:19:59.341Z",
        "name": "xxx@xxx.com",
        "picture": "https://s.gravatar.com/avatar/6c5d28268a39dc9dd5d1459dde63c30b?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fvb.png",
        "user_id": "auth0|59417567a5xxx26b1xxx8065",
        "nickname": "xxx",
        "identities": 
            {
                "user_id": "59417567a5xxx26b1xxx8065",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "created_at": "2017-06-14T17:42:00.273Z",
        "last_ip": "200.37.162.55",
        "last_login": "2017-07-17T20:19:59.341Z",
        "logins_count": 222,
        "app_metadata": {
            "roles": 
                "Admin",
                "Affiliate",
                "Client"
            ]
        }
    },
    {
        "email_verified": false,
        "email": "yyy@yyy.com",
        "updated_at": "2017-07-17T17:53:59.796Z",
        "name": "yyy@yyy.com",
        "picture": "https://s.gravatar.com/avatar/6e76169e601ce8ba0f9790b2efce4e99?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fav.png",
        "user_id": "auth0|595cfe158yyye5530yyyd9bc",
        "nickname": "yyy",
        "identities": 
            {
                "user_id": "595cfe158yyye5530yyyd9bc",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "created_at": "2017-07-05T14:56:21.726Z",
        "last_ip": "181.65.186.57",
        "last_login": "2017-07-17T17:53:59.796Z",
        "logins_count": 7,
        "app_metadata": {
            "roles": 
                "Admin",
                "Affiliate",
                "Client"
            ]
        }
    },
    {
        "email_verified": true,
        "email": "zzz@zzz.com",
        "updated_at": "2017-07-17T17:53:55.239Z",
        "name": "zzz@zzz.com",
        "picture": "https://s.gravatar.com/avatar/505660069221ccfa73386b8e2350ee9f?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fgb.png",
        "user_id": "auth0|595e5c8bzzzae553zzz0666b",
        "nickname": "zzz",
        "identities": 
            {
                "user_id": "595e5c8bzzzae553zzz0666b",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "created_at": "2017-07-06T15:51:39.698Z",
        "last_login": "2017-07-16T15:31:50.364Z",
        "logins_count": 7,
        "app_metadata": {
            "roles": 
                "Client",
                "Affiliate"
            ]
        }
    },
    {
        "email": "john.doe@gmail.com",
        "email_verified": false,
        "user_id": "auth0|596d1def790837489f4c7d48",
        "picture": "https://s.gravatar.com/avatar/e13743a7f1db7f4246badd6fd6ff54ff?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fjo.png",
        "identities": 
            {
                "user_id": "596d1def790837489f4c7d48",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "updated_at": "2017-07-17T20:28:31.662Z",
        "created_at": "2017-07-17T20:28:31.662Z"
    },
    {
        "email": "johnny@gmail.com",
        "nickname": "johnny",
        "email_verified": false,
        "user_id": "auth0|596d20155fd3c54c71f919a5",
        "picture": "https://s.gravatar.com/avatar/136c70acb946f0f37b12bb6fbfe56f2c?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fjo.png",
        "identities": 
            {
                "user_id": "596d20155fd3c54c71f919a5",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "updated_at": "2017-07-17T20:37:41.842Z",
        "created_at": "2017-07-17T20:37:41.842Z"
    },
    {
        "email": "efendashe@gmail.com",
        "email_verified": true,
        "user_id": "auth0|596d249b6c6fa53f6c21d8cc",
        "picture": "https://s.gravatar.com/avatar/0db4948477d5c16656e1eeb003fb047f?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fef.png",
        "identities": 
            {
                "user_id": "596d249b6c6fa53f6c21d8cc",
                "provider": "auth0",
                "connection": "Username-Password-Authentication",
                "isSocial": false
            }
        ],
        "updated_at": "2017-07-17T20:57:19.388Z",
        "created_at": "2017-07-17T20:56:59.020Z"
    }
]

If you check the last 3 unmodified test users, they do not have the same user profile structure and they are still Auth0 because I have disabled social logins in my application. So that is why I am wondering why Angular tables have such a hard time showing them as users, or why is the structure in data is so different.


#4

Can you clarify what differences in structure you see? The only ones I spot are that some do not have app_metadata, which is expected if you haven’t set any for that user. The user profiles that are being returned are what are expected, as outlined in the documentation.


#5