Auth0 Home Blog Docs

Searching for users who are using a specific connection

#1

We’re starting to implement a passwordless solution to our application. This also means that we need to update our existing users who are accessing a specific connection with a linked email connection.

Basically, I’m going through each of the users in our database, attempting to look them up on Auth0 using the management API’s Search User functionality (we’re using V2). Once found, I check to see if there is an email connection associated with the user and, if not, create one and then link it to the primary user’s profile. The problem I have is that some of our internal people also have a connection set up for another application we have running and I don’t want to create an email connection and link it to the wrong primary connection.

Is there a way to limit the management API’s search to a specific connection? It appears that there are two places you can designate the connection; either in the “connection=” or the “identities.connection:” portion of the query. The problem is that when I add the “identities.connection:” parameter there are times when the API doesn’t find the user, though I can see that user when searching through the dashboard. The “connection=” portion of the query string doesn’t seem to pull just the user’s information for JUST that connection, but returns all connections the user has associated with themselves.

The query string I’m currently using, which sometimes finds and other time does not find the user is:
queryString = connection=“auth0Connection1”&q=email.raw:“userEmail” AND identities.connection:"_auth0Connection1"&search_engine=v2

Any suggestions? I’m flumoxed.