How to connect profiles with one email in one account with a unique identifier in Firebase ?

UPDATE
My decision:
1. In the console, Firebase allowed to register several accounts with the same email; 2. The profile information is stored in the database by the link / users / id / , where id is an email, in which the symbol is '.' replaced by ',' (for Firebase does not allow storing the character '.';
3. In the end. Upon registration: by email I get an id and see if there is a / users / id / entry, if not - create it, if it does, just pick it up. When logging in, regardless of the provider, I get an id via email and get the record / users / id / .
4. It is possible that problems may arise during the formation of write / read rights. I haven’t got acquainted with this moment yet, I can’t say for sure.

    1 answer 1

    For binding, the FirebaseAuth.getCurrentUser().linkWithCredential(credential) function is used FirebaseAuth.getCurrentUser().linkWithCredential(credential)

    Procedure:

    1. Authorize user.
    2. Offer to authorize the provider who needs to bind to the existing one.
    3. Get credentials. For mail it is:

      AuthCredential credential = EmailAuthProvider.getEmailAuthCredential(email, password)

    4. Call linkWithCredential()

    Documentation:

    https://firebase.google.com/docs/auth/android/account-linking

    • I'm not sure that accounts are combined by email. And if my friend from my device went into my account, then you can not merge. profiles In addition, as I understand it, with each registration FirebaseAuth.getCurrentUser () will have its own UID. - differ
    • @differ contacts any existing provider with any other provider. - iw2rmb