I have a rails app connecting to Salesforce through restforce gem. I am trying to map Rails users with Salesforce contact records—so when they log in to my rails app it pulls the record from Salesforce. What will be the best way to do this?
For example, I have devise installed for user authentication.
Scenario 1 - Mapping New Rails User to Existing Salesforce Contact Rails app: John is User1 has an id of "001" and email of "firstname.lastname@example.org" Salesforce: John is an existing Contact1 and has Contact ID of "003C000001lniUd" and email of "email@example.com"
How to map these two, so Rails user John can see only his record from Salesforce Contact? It seems like only way is to connect the dot is through email, but our database might have few Contact records with "firstname.lastname@example.org" in Salesforce.
Scenario 2 - Mapping New Rails User to Create New Salesforce Contact and Mapping the two Rails app: New User2 is created in Rails app with an id of "0001" with an email "email@example.com"
How to check if there is not duplicate in Salesforce?
I hope this is making sense... Any advice is welcomed. Thanks.