This is indeed a typical case. I have struggled with some variation of it recently (from user perspective; this time it was a little bit different, as the service allows multiple email addresses to be assigned to one account to mail-in data, but it's very similar anyway).
Just to summarize the assumptions:
- there is a system that allows linking a bunch of credentials (e.g. multiple email addresses, FBID, LinkedIn login etc.)
- within this system there is first account created using a unique set of credentials (e.g. email aaa@email.com)
- there is second account created using a different unique set of credentials (e.g. FBID)
- user logs in to the first account using the and wants to link the FBID used in his other account
From the system's perspective these are two different accounts so you just cannot do this automatically. The user has done bad (it's one of his rights, anyway), and there is a need to tidy up. I can suggest two ways out of this:
Option 1: Closing one of the accounts.
This is a simple option, easier to implement but with some downsides, like not preserving user data from one of the accounts. User just needs to close one account to free a set of credentials that was blocked.
Just inform user that it is not possible to link the other set of credentials, as it is already linked to another account. Then suggest logging in to the other account, delete it and come back to the first account to retry merging. The downside is that, once deleted, user will most probably loose all the data stored within that other account.
Option 2: Merging accounts
This option is more complicated but leads to better results as user data is preserved, so from user's point of view it is a cosmetic change.
Inform user again that it is not possible to link the other set of credentials because these are linked to another account. Suggest merging accounts. Give the user a possibility to provide full credentials to the other second account while being logged in as the first account. If the credentials to the second account are correct, user should be able to decide how the accounts should be merged and thus needs to be presented a form (or: wizard) that will help him to do it, containing for example:
- Which user data - as nickname first name, second name, addresses he wants to use (from the first or second account?)
- What to do with the data data collected by user (e.g. bookmarks or whatever else) within each of these accounts? (Merge/Keep only 1st account data/Keep only 2nd account data)
It should be followed by a big button [I want these accounts to be merged] and a smaller one saying [No, I have changed my mind]. Of course you need to explain to the user that this operation is irreversible, and tell him which credentials he will be able to log in with now.