Is there a way via the management API for me to trigger a custom DB behavior/scripts, like get_user.js?
Context: we allow users to log on via social connections, and use https://github.com/auth0/rules/blob/master/src/rules/link-users-by-email.js to link them to a database user, if they have one.
In the case that this is an existing user in my custom DB connection backend, but they haven’t logged in with user/password yet (because they’ve only used the social auth button!), then they won’t yet show up in the Auth0 user database … and therefore I cannot link them.
Expected behavior is that the user will fetch/sync when I search by email over the management API, and then I can link them. This is important to us because their existing account has valuable metadata (like their username!), and I want to make sure it is their primary identity in Auth0 if they have one.
v2/users-by-email will not find them (it does NOT trigger get_user.js custom DB script to search emails). From my rule, I can search my custom DB directly and find the same email and their username … then I still don’t know how to get the user into Auth0 for linking. I can’t create the user over the management API, because that would trigger a create.js script, which would fail (they already HAVE an account in the custom DB).
My best guess is I could set up a resource owner password grant, which I hit with the username/email and a bogus password, just to get Auth0 to fetch/sync the account (I don’t know the user’s actual password, of course). But I think this might get the Auth0 webtask IP(s) blacklisted
Anyone else ran into this and have a solution? Is there something in the Auth0 Management API to search/sync from the custom DB on the fly that I’m missing?