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

For standard connections, the value of user.identity.connection is the connection.name. 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 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.

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

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.