# Management api problem/bug - custom connections linked to users incorrect

**URL:** <https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695>\
**Category:** Get Help\
**Tags:** api, identity, users, connections\
**Created:** [May 20, 2017, 8:00am UTC](https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695 "2017-05-20T08:00:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cory](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/cory/32/6270_2.png) [@cory](https://community.auth0.com/u/cory)\
**Post date:** [May 20, 2017, 8:00am UTC](https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695/1 "2017-05-20T08:00:20Z")

</div>

For standard connections, the value of [user.identity.connection is the connection.name](https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id). However, for custom oauth2 connections that are linked to a user, the value is always “oauth2”.

The value of these linked connections should be the connection.name too.

#### Steps to reproduce:

1. Create a new user Joe Regular with a “Database-Connection” in Client #1
2. Create a custom oauth2 connection using a non-builtin provider and name it “Shopify-Connection” e.g. Shopify
3. Authorize a user Bob Shopify against the connection using Client #2
4. [Link](https://auth0.com/docs/api/management/v2#!/Users/post_identities) the Bob account to Joe’s to merge the identities

There will now be two identities under Joe.

1. `user.identity[0].connection: "Database-Connection"`
2. `user.identity[1].connection: "oauth2"` \<= this should be “Shopify-Connection”

The only workaround I’ve found is encoding the true connection.name into the user\_id.

===

**Also - Why doesn’t user.identity include the connection.id in the response?** That information would be extremely useful in finding which identity belongs to which connection.

Edit: That’s weird. Now I’m seeing `connection_id` in my identity responses.

---

<div class="post-metadata">

**Author:** ![cory](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/cory/32/6270_2.png) [@cory](https://community.auth0.com/u/cory)\
**Post date:** [May 23, 2017, 1:17am UTC](https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695/2 "2017-05-23T01:17:24Z")

</div>

Did someone address this? I’m now seeing `connect.name` in `identity[n].connection`. Don’t think it was my code…

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [May 26, 2017, 6:43pm UTC](https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695/3 "2017-05-26T18:43:10Z")

</div>

I did a quick test with a database user and a custom OAuth2 connection and was not able to reproduce this issue; I’m also not aware of any recent change. One thing to take in consideration is that `oauth2` will indeed appear within the identities array, but associated to the `provider` property. More specifically you may get multiple identities with the same provider.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:54am UTC](https://community.auth0.com/t/management-api-problem-bug-custom-connections-linked-to-users-incorrect/6695/4 "2018-03-02T05:54:02Z")

</div>


