When I use the ‘Link Accounts with Same Email Address’ rule my original userid is replaced with the userid of the user that has just logged in. This is problematic as I was storing the original userid in my database.
Is there a version of the ‘Link Accounts with Same Email Address’ rule which maintains the original userid?
If there isn’t how would you suggest I handle this?
This is strange because according to the linking accounts documentation, “The user_id and all other main profile properties continue to be those of the primary identity.”, meaning that the user_id it is not replaced. Did you make any change in the rule original code? Also, how are you checking that the user_id is replaced? I mean, are you checking it in the dashboard?
@paulimar.angulo The linking documentation you are refering to applies to when you are linking accounts manually. I am trying to link the accounts automatically using the auth0 rule ‘Link Accounts with Same Email Address’. This rule is definitely replacing user_id, I am checking it in the dashboard and I have not modified the rule.
Developers integrating with custom databases rely on the user_id being the same. If there isn’t a rule already could someone at Auth0 create one and post to the official rules or to this forum.
@jculverwell - Did you ever solve this? I also have this issue, and unique id is important since I’m using a custom database + Segment tracking (anlytics). Besides that, did you notice that logins_count field is reset to 1 when you link a new account? And users who link their account to e.g. Google get another “Welcome” email…
I tried writing a rule to handle this, but while it does seem to have merged the account in-place by adding the new identity to the old account, it also appears to have left a “hanging account” around and the new google based account appears half-there and broken.
I also emailed support about this, but I’m attaching my modified rule here in case anyone has any ideas.[link text][1]
I was actually able to find a work-around for this issue, although it’s quite messy, it does work.
Essentially, this solution requires users to first log in with their Google account, then back in with their Auth0 database account. Once that’s done, it merges their google account back into their Auth0 account, and future logins with their Google account work.
We’ve addressed the problem you mention by introducing a new context.primaryUser property that can be set to the user_id of which user should be the primary user.
@paulimar.angulo The linking documentation you are refering to applies to when you are linking accounts manually. I am trying to link the accounts automatically using the auth0 rule ‘Link Accounts with Same Email Address’. This rule is definitely replacing user_id, I am checking it in the dashboard and I have not modified the rule.
Developers integrating with custom databases rely on the user_id being the same. If there isn’t a rule already could someone at Auth0 create one and post to the official rules or to this forum.
Hi @paulimar.angulo ,
I have this issue as well. I created a rule and selected the pre-made rule “Link Accounts with Same Email Address while Merging Metadata” (which is similar to the one chosen by @jculverwell “Link Accounts with Same Email Address”).