How to use more than one type of identifier for contact identification?

325 views Asked by At

Our website is using DocCheck, an external authentication provider, to authenticate and identify contacts. We use the DocCheck ID, which comes as the request parameter "uniquekey", as contact identifier, so that the contact, when logging in on another device, can be re-identified. These users are then authenticated in Sitecore via a virtual user.

Tracker.Current.CurrentPage.Session.Identify(Page.Request.QueryString["uniquekey"]);

In addition to that, we're planning an own user management with registration, login etc. The users will be logged in via email address and password. The email address should now be used as another identifier to identify the contacts loggin in with these credentials.

The users should then be able to use both DocCheck and our own login for different parts of our website, so that we have DocCheck contacts and our own users.

Is it possible to combine these two identifiers to identify as one contact?

Thank you and kind regards

Torsten

1

There are 1 answers

0
boro2g On

At the moment you can only use a single value to identify a user within xDB. This is potentially going to change in the future however for now you can only use one.

xDB is just a mongo database so how about persisting an additional collection that contains the relationship between identifiers. An example would be:

CustomContact
- _id: the xDB identifier
- alternativeIdentifiers: [docCheckId, formsAuthId, etc] - if this is indexed the lookup will be quick

Then when you come to identify the user you lookup in your custom collection your identifier, find the actual xDB id and then identify with that.

To find the item in the array look at elemMatch or in: https://docs.mongodb.org/manual/reference/operator/projection/elemMatch/ and some examples on https://stackoverflow.com/a/18149149/1065332