/users/<user-id> returns inconsistent type for identities `user_id`

I have a user with two identities: GitHub and Google.
When I make a request for a list of users (GET /api/v2/users), response looks like (removed unimportant fields):

[
    {
        ...
        "identities": [
            {
                "provider": "github",
                "user_id": "123456"
            },
            {
                "provider": "google-oauth2",
                "user_id": "110315005260569123456"
            }
        ],
        "user_id": "github|123456"
    }
]

Notice that both identities have user_id as a string.

When I make a request for a specific users (GET /api/v2/users/), response looks like (removed unimportant fields):

{
    ...
    "identities": [
        {
            "provider": "github",
            "user_id": 123456
        },
        {
            "provider": "google-oauth2",
            "user_id": "110315005260569123456"
        }
    ],
    "user_id": "github|123456"
}

Notice that this time github identity’s user_id is a number, while google identity still have a string.

It looks like a bug and introduces a few problems:

  1. essentially the same data is inconsistent between two endpoints
  2. data schema is inconsistent between two identities in the same response

Both of these create problems using this data, particularly in a strong typed languages (eg. Go).

Hi @anton2,

thanks for reporting. I can reproduce it and that seems to be a bug. I’ve created a ticket internally.

Thank you @mathiasconradt. Is there any way I can track the status of this bug?

No, the product bugtracker is internal. I’ll try to follow up on this and update this thread accordingly once I get an update myself.

2 Likes